add generated interfaces
[isl.git] / isl_polynomial_private.h
blob2f782655b790b306b2610346b1fe23043d18388c
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_local.h>
8 #include <isl_reordering.h>
9 #include "isl_list_private.h"
11 struct isl_poly {
12 int ref;
13 struct isl_ctx *ctx;
15 int var;
17 typedef struct isl_poly isl_poly;
19 struct isl_poly_cst {
20 struct isl_poly poly;
21 isl_int n;
22 isl_int d;
24 typedef struct isl_poly_cst isl_poly_cst;
26 struct isl_poly_rec {
27 struct isl_poly poly;
28 int n;
30 size_t size;
31 isl_poly *p[];
33 typedef struct isl_poly_rec isl_poly_rec;
35 /* dim represents the domain space.
37 struct isl_qpolynomial {
38 int ref;
40 isl_space *dim;
41 struct isl_mat *div;
42 isl_poly *poly;
45 #undef EL
46 #define EL isl_qpolynomial
48 #include <isl_list_templ.h>
50 struct isl_term {
51 int ref;
53 isl_int n;
54 isl_int d;
56 isl_space *dim;
57 struct isl_mat *div;
59 int pow[1];
62 struct isl_pw_qpolynomial_piece {
63 struct isl_set *set;
64 struct isl_qpolynomial *qp;
67 struct isl_pw_qpolynomial {
68 int ref;
70 isl_space *dim;
72 int n;
74 size_t size;
75 struct isl_pw_qpolynomial_piece p[1];
78 #undef PW
79 #define PW isl_pw_qpolynomial
81 #include <isl_pw_templ.h>
83 #undef EL
84 #define EL isl_pw_qpolynomial
86 #include <isl_list_templ.h>
88 /* dim represents the domain space.
90 struct isl_qpolynomial_fold {
91 int ref;
93 enum isl_fold type;
94 isl_space *dim;
96 isl_qpolynomial_list *list;
99 struct isl_pw_qpolynomial_fold_piece {
100 struct isl_set *set;
101 struct isl_qpolynomial_fold *fold;
104 struct isl_pw_qpolynomial_fold {
105 int ref;
107 enum isl_fold type;
108 isl_space *dim;
110 int n;
112 size_t size;
113 struct isl_pw_qpolynomial_fold_piece p[1];
116 #undef PW
117 #define PW isl_pw_qpolynomial_fold
119 #include <isl_pw_templ.h>
121 #undef EL
122 #define EL isl_pw_qpolynomial_fold
124 #include <isl_list_templ.h>
126 void isl_term_get_num(__isl_keep isl_term *term, isl_int *n);
128 __isl_give isl_poly *isl_poly_zero(struct isl_ctx *ctx);
129 __isl_give isl_poly *isl_poly_copy(__isl_keep isl_poly *poly);
130 __isl_give isl_poly *isl_poly_cow(__isl_take isl_poly *poly);
131 __isl_give isl_poly *isl_poly_dup(__isl_keep isl_poly *poly);
132 __isl_null isl_poly *isl_poly_free(__isl_take isl_poly *poly);
133 __isl_give struct isl_poly *isl_poly_mul(__isl_take struct isl_poly *poly1,
134 __isl_take struct isl_poly *poly2);
136 isl_bool isl_poly_is_cst(__isl_keep isl_poly *poly);
137 isl_bool isl_poly_is_zero(__isl_keep isl_poly *poly);
138 isl_bool isl_poly_is_one(__isl_keep isl_poly *poly);
139 isl_bool isl_poly_is_negone(__isl_keep isl_poly *poly);
140 __isl_keep isl_poly_cst *isl_poly_as_cst(__isl_keep isl_poly *poly);
141 __isl_keep isl_poly_rec *isl_poly_as_rec(__isl_keep isl_poly *poly);
143 __isl_give isl_poly *isl_poly_sum(__isl_take isl_poly *poly1,
144 __isl_take isl_poly *poly2);
145 __isl_give struct isl_poly *isl_poly_mul_isl_int(
146 __isl_take isl_poly *poly, isl_int v);
148 __isl_give isl_qpolynomial *isl_qpolynomial_alloc(__isl_take isl_space *space,
149 unsigned n_div, __isl_take isl_poly *poly);
150 __isl_give isl_qpolynomial *isl_qpolynomial_cow(__isl_take isl_qpolynomial *qp);
151 __isl_give isl_qpolynomial *isl_qpolynomial_dup(__isl_keep isl_qpolynomial *qp);
153 __isl_give isl_qpolynomial *isl_qpolynomial_cst_on_domain(
154 __isl_take isl_space *domain,
155 isl_int v);
156 __isl_give isl_qpolynomial *isl_qpolynomial_rat_cst_on_domain(
157 __isl_take isl_space *domain, const isl_int n, const isl_int d);
158 __isl_give isl_qpolynomial *isl_qpolynomial_var_pow_on_domain(
159 __isl_take isl_space *domain,
160 int pos, int power);
161 isl_bool isl_qpolynomial_is_one(__isl_keep isl_qpolynomial *qp);
162 isl_bool isl_qpolynomial_is_affine(__isl_keep isl_qpolynomial *qp);
163 isl_bool isl_qpolynomial_is_cst(__isl_keep isl_qpolynomial *qp,
164 isl_int *n, isl_int *d);
166 unsigned isl_qpolynomial_domain_offset(__isl_keep isl_qpolynomial *qp,
167 enum isl_dim_type type);
168 __isl_give isl_local *isl_qpolynomial_get_local(
169 __isl_keep isl_qpolynomial *qp);
171 __isl_give isl_qpolynomial *isl_qpolynomial_add_on_domain(
172 __isl_keep isl_set *dom,
173 __isl_take isl_qpolynomial *qp1,
174 __isl_take isl_qpolynomial *qp2);
176 int isl_qpolynomial_plain_cmp(__isl_keep isl_qpolynomial *qp1,
177 __isl_keep isl_qpolynomial *qp2);
179 int isl_qpolynomial_degree(__isl_keep isl_qpolynomial *poly);
180 __isl_give isl_qpolynomial *isl_qpolynomial_coeff(
181 __isl_keep isl_qpolynomial *poly,
182 enum isl_dim_type type, unsigned pos, int deg);
184 __isl_give isl_vec *isl_qpolynomial_extract_affine(
185 __isl_keep isl_qpolynomial *qp);
186 __isl_give isl_qpolynomial *isl_qpolynomial_from_affine(
187 __isl_take isl_space *space, isl_int *f, isl_int denom);
189 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_cow(
190 __isl_take isl_pw_qpolynomial *pwqp);
192 __isl_keep isl_qpolynomial *isl_pw_qpolynomial_peek_base_at(
193 __isl_keep isl_pw_qpolynomial *pwqp, int pos);
195 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_piece(
196 __isl_take isl_pw_qpolynomial *pwqp,
197 __isl_take isl_set *set, __isl_take isl_qpolynomial *qp);
198 int isl_pw_qpolynomial_is_one(__isl_keep isl_pw_qpolynomial *pwqp);
200 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_project_out(
201 __isl_take isl_pw_qpolynomial *pwqp,
202 enum isl_dim_type type, unsigned first, unsigned n);
204 __isl_give isl_val *isl_qpolynomial_opt_on_domain(
205 __isl_take isl_qpolynomial *qp, __isl_take isl_set *set, int max);
207 enum isl_fold isl_fold_type_negate(enum isl_fold type);
209 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_cow(
210 __isl_take isl_qpolynomial_fold *fold);
211 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_dup(
212 __isl_keep isl_qpolynomial_fold *fold);
214 __isl_keep isl_qpolynomial_list *isl_qpolynomial_fold_peek_list(
215 __isl_keep isl_qpolynomial_fold *fold);
217 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_cow(
218 __isl_take isl_pw_qpolynomial_fold *pwf);
220 __isl_keep isl_qpolynomial_fold *isl_pw_qpolynomial_fold_peek_base_at(
221 __isl_keep isl_pw_qpolynomial_fold *pwf, int pos);
223 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_add_on_domain(
224 __isl_keep isl_set *set,
225 __isl_take isl_qpolynomial_fold *fold1,
226 __isl_take isl_qpolynomial_fold *fold2);
227 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_fold_on_domain(
228 __isl_keep isl_set *set,
229 __isl_take isl_qpolynomial_fold *fold1,
230 __isl_take isl_qpolynomial_fold *fold2);
232 int isl_qpolynomial_fold_plain_cmp(__isl_keep isl_qpolynomial_fold *fold1,
233 __isl_keep isl_qpolynomial_fold *fold2);
235 __isl_give isl_val *isl_qpolynomial_fold_opt_on_domain(
236 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_set *set, int max);
238 isl_bool isl_pw_qpolynomial_fold_covers(
239 __isl_keep isl_pw_qpolynomial_fold *pwf1,
240 __isl_keep isl_pw_qpolynomial_fold *pwf2);
242 __isl_give isl_qpolynomial *isl_qpolynomial_morph_domain(
243 __isl_take isl_qpolynomial *qp, __isl_take isl_morph *morph);
244 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_morph_domain(
245 __isl_take isl_pw_qpolynomial *pwqp, __isl_take isl_morph *morph);
246 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_morph_domain(
247 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_morph *morph);
248 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_morph_domain(
249 __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_morph *morph);
251 __isl_give isl_qpolynomial *isl_qpolynomial_lift(__isl_take isl_qpolynomial *qp,
252 __isl_take isl_space *space);
253 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_lift(
254 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_space *space);
256 __isl_give isl_qpolynomial *isl_qpolynomial_substitute_equalities(
257 __isl_take isl_qpolynomial *qp, __isl_take isl_basic_set *eq);
258 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_substitute_equalities(
259 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_basic_set *eq);
260 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
261 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_set *context);
263 __isl_give isl_qpolynomial *isl_qpolynomial_realign_domain(
264 __isl_take isl_qpolynomial *qp, __isl_take isl_reordering *r);
265 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_realign_domain(
266 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_reordering *r);
268 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_reset_space(
269 __isl_take isl_pw_qpolynomial *pwqp, __isl_take isl_space *space);
270 __isl_give isl_qpolynomial *isl_qpolynomial_reset_domain_space(
271 __isl_take isl_qpolynomial *qp, __isl_take isl_space *space);
272 __isl_give isl_qpolynomial *isl_qpolynomial_reset_space_and_domain(
273 __isl_take isl_qpolynomial *qp, __isl_take isl_space *space,
274 __isl_take isl_space *domain);
275 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_reset_domain_space(
276 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_space *space);
277 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_reset_space_and_domain(
278 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_space *space,
279 __isl_take isl_space *domain);
280 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_reset_domain_space(
281 __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_space *space);
283 __isl_give isl_val *isl_qpolynomial_get_den(__isl_keep isl_qpolynomial *qp);
284 __isl_give isl_qpolynomial *isl_qpolynomial_add_isl_int(
285 __isl_take isl_qpolynomial *qp, isl_int v);
286 __isl_give isl_qpolynomial *isl_qpolynomial_mul_isl_int(
287 __isl_take isl_qpolynomial *qp, isl_int v);
289 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_scale(
290 __isl_take isl_qpolynomial_fold *fold, isl_int v);
292 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_mul_isl_int(
293 __isl_take isl_qpolynomial_fold *fold, isl_int v);
295 ISL_DECLARE_LIST_FN_PRIVATE(qpolynomial)