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"
9
10struct isl_poly {
11 int ref;
12 struct isl_ctx *ctx;
13
14 int var;
15};
16typedef struct isl_poly isl_poly;
17
18struct isl_poly_cst {
19 struct isl_poly poly;
20 isl_int n;
21 isl_int d;
22};
23typedef struct isl_poly_cst isl_poly_cst;
24
25struct isl_poly_rec {
26 struct isl_poly poly;
27 int n;
28
29 size_t size;
30 isl_poly *p[];
31};
32typedef struct isl_poly_rec isl_poly_rec;
33
34/* dim represents the domain space.
35 */
36struct isl_qpolynomial {
37 int ref;
38
39 isl_space *dim;
40 struct isl_mat *div;
41 isl_poly *poly;
42};
43
44#undef EL
45#define EL isl_qpolynomial
46
47#include <isl_list_templ.h>
48
49struct isl_term {
50 int ref;
51
52 isl_int n;
53 isl_int d;
54
55 isl_space *dim;
56 struct isl_mat *div;
57
58 int pow[1];
59};
60
61struct isl_pw_qpolynomial_piece {
62 struct isl_set *set;
63 struct isl_qpolynomial *qp;
64};
65
66struct isl_pw_qpolynomial {
67 int ref;
68
69 isl_space *dim;
70
71 int n;
72
73 size_t size;
74 struct isl_pw_qpolynomial_piece p[1];
75};
76
77#undef PW
78#define PW isl_pw_qpolynomial
79
80#include <isl_pw_templ.h>
81
82#undef EL
83#define EL isl_pw_qpolynomial
84
85#include <isl_list_templ.h>
86
87/* dim represents the domain space.
88 */
89struct isl_qpolynomial_fold {
90 int ref;
91
92 enum isl_fold type;
93 isl_space *dim;
94
95 isl_qpolynomial_list *list;
96};
97
98struct isl_pw_qpolynomial_fold_piece {
99 struct isl_set *set;
100 struct isl_qpolynomial_fold *fold;
101};
102
103struct isl_pw_qpolynomial_fold {
104 int ref;
105
106 enum isl_fold type;
107 isl_space *dim;
108
109 int n;
110
111 size_t size;
112 struct isl_pw_qpolynomial_fold_piece p[1];
113};
114
115#undef PW
116#define PW isl_pw_qpolynomial_fold
117
118#include <isl_pw_templ.h>
119
120#undef EL
121#define EL isl_pw_qpolynomial_fold
122
123#include <isl_list_templ.h>
124
125void isl_term_get_num(__isl_keep isl_term *term, isl_int *n);
126
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);
134
135isl_bool isl_poly_is_cst(__isl_keep isl_poly *poly);
136isl_bool isl_poly_is_zero(__isl_keep isl_poly *poly);
137isl_bool isl_poly_is_one(__isl_keep isl_poly *poly);
138isl_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);
141
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);
146
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);
151
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);
160isl_bool isl_qpolynomial_is_one(__isl_keep isl_qpolynomial *qp);
161isl_bool isl_qpolynomial_is_affine(__isl_keep isl_qpolynomial *qp);
162isl_bool isl_qpolynomial_is_cst(__isl_keep isl_qpolynomial *qp,
163 isl_int *n, isl_int *d);
164
165unsigned isl_qpolynomial_domain_offset(__isl_keep isl_qpolynomial *qp,
166 enum isl_dim_type type);
167
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);
172
173int isl_qpolynomial_plain_cmp(__isl_keep isl_qpolynomial *qp1,
174 __isl_keep isl_qpolynomial *qp2);
175
176int 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);
180
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);
185
186__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_cow(
187 __isl_take isl_pw_qpolynomial *pwqp);
188
189__isl_keep isl_qpolynomial *isl_pw_qpolynomial_peek_base_at(
190 __isl_keep isl_pw_qpolynomial *pwqp, int pos);
191
192__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_piece(
193 __isl_take isl_pw_qpolynomial *pwqp,
194 __isl_take isl_set *set, __isl_take isl_qpolynomial *qp);
195int isl_pw_qpolynomial_is_one(__isl_keep isl_pw_qpolynomial *pwqp);
196
197__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_project_out(
198 __isl_take isl_pw_qpolynomial *pwqp,
199 enum isl_dim_type type, unsigned first, unsigned n);
200
201__isl_give isl_val *isl_qpolynomial_opt_on_domain(
202 __isl_take isl_qpolynomial *qp, __isl_take isl_set *set, int max);
203
204enum isl_fold isl_fold_type_negate(enum isl_fold type);
205
206__isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_cow(
207 __isl_take isl_qpolynomial_fold *fold);
208__isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_dup(
209 __isl_keep isl_qpolynomial_fold *fold);
210
211__isl_keep isl_qpolynomial_list *isl_qpolynomial_fold_peek_list(
212 __isl_keep isl_qpolynomial_fold *fold);
213
214__isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_cow(
215 __isl_take isl_pw_qpolynomial_fold *pwf);
216
217__isl_keep isl_qpolynomial_fold *isl_pw_qpolynomial_fold_peek_base_at(
218 __isl_keep isl_pw_qpolynomial_fold *pwf, int pos);
219
220__isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_add_on_domain(
221 __isl_keep isl_set *set,
222 __isl_take isl_qpolynomial_fold *fold1,
223 __isl_take isl_qpolynomial_fold *fold2);
224__isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_fold_on_domain(
225 __isl_keep isl_set *set,
226 __isl_take isl_qpolynomial_fold *fold1,
227 __isl_take isl_qpolynomial_fold *fold2);
228
229int isl_qpolynomial_fold_plain_cmp(__isl_keep isl_qpolynomial_fold *fold1,
230 __isl_keep isl_qpolynomial_fold *fold2);
231
232__isl_give isl_val *isl_qpolynomial_fold_opt_on_domain(
233 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_set *set, int max);
234
235isl_bool isl_pw_qpolynomial_fold_covers(
236 __isl_keep isl_pw_qpolynomial_fold *pwf1,
237 __isl_keep isl_pw_qpolynomial_fold *pwf2);
238
239__isl_give isl_qpolynomial *isl_qpolynomial_morph_domain(
240 __isl_take isl_qpolynomial *qp, __isl_take isl_morph *morph);
241__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_morph_domain(
242 __isl_take isl_pw_qpolynomial *pwqp, __isl_take isl_morph *morph);
243__isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_morph_domain(
244 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_morph *morph);
245__isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_morph_domain(
246 __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_morph *morph);
247
248__isl_give isl_qpolynomial *isl_qpolynomial_lift(__isl_take isl_qpolynomial *qp,
249 __isl_take isl_space *space);
250__isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_lift(
251 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_space *space);
252
253__isl_give isl_qpolynomial *isl_qpolynomial_substitute_equalities(
254 __isl_take isl_qpolynomial *qp, __isl_take isl_basic_set *eq);
255__isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_substitute_equalities(
256 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_basic_set *eq);
257__isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
258 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_set *context);
259
260__isl_give isl_qpolynomial *isl_qpolynomial_realign_domain(
261 __isl_take isl_qpolynomial *qp, __isl_take isl_reordering *r);
262__isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_realign_domain(
263 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_reordering *r);
264
265__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_reset_space(
266 __isl_take isl_pw_qpolynomial *pwqp, __isl_take isl_space *space);
267__isl_give isl_qpolynomial *isl_qpolynomial_reset_domain_space(
268 __isl_take isl_qpolynomial *qp, __isl_take isl_space *space);
269__isl_give isl_qpolynomial *isl_qpolynomial_reset_space_and_domain(
270 __isl_take isl_qpolynomial *qp, __isl_take isl_space *space,
271 __isl_take isl_space *domain);
272__isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_reset_domain_space(
273 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_space *space);
274__isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_reset_space_and_domain(
275 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_space *space,
276 __isl_take isl_space *domain);
277__isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_reset_domain_space(
278 __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_space *space);
279
280__isl_give isl_val *isl_qpolynomial_get_den(__isl_keep isl_qpolynomial *qp);
281__isl_give isl_qpolynomial *isl_qpolynomial_add_isl_int(
282 __isl_take isl_qpolynomial *qp, isl_int v);
283__isl_give isl_qpolynomial *isl_qpolynomial_mul_isl_int(
284 __isl_take isl_qpolynomial *qp, isl_int v);
285
286__isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_scale(
287 __isl_take isl_qpolynomial_fold *fold, isl_int v);
288
289__isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_mul_isl_int(
290 __isl_take isl_qpolynomial_fold *fold, isl_int v);
291
292ISL_DECLARE_LIST_FN_PRIVATE(qpolynomial)
293

source code of polly/lib/External/isl/isl_polynomial_private.h