isl_map_union_disjoint: check spaces before handling special cases
[isl.git] / isl_polynomial_private.h
bloba668469e1243742dee9df7952e8c488bbfba2937
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 /* dim represents the domain space.
70 struct isl_qpolynomial_fold {
71 int ref;
73 enum isl_fold type;
74 isl_space *dim;
76 int n;
78 size_t size;
79 struct isl_qpolynomial *qp[1];
82 struct isl_pw_qpolynomial_fold_piece {
83 struct isl_set *set;
84 struct isl_qpolynomial_fold *fold;
87 struct isl_pw_qpolynomial_fold {
88 int ref;
90 enum isl_fold type;
91 isl_space *dim;
93 int n;
95 size_t size;
96 struct isl_pw_qpolynomial_fold_piece p[1];
99 void isl_term_get_num(__isl_keep isl_term *term, isl_int *n);
101 __isl_give struct isl_upoly *isl_upoly_zero(struct isl_ctx *ctx);
102 __isl_give struct isl_upoly *isl_upoly_copy(__isl_keep struct isl_upoly *up);
103 __isl_give struct isl_upoly *isl_upoly_cow(__isl_take struct isl_upoly *up);
104 __isl_give struct isl_upoly *isl_upoly_dup(__isl_keep struct isl_upoly *up);
105 void isl_upoly_free(__isl_take struct isl_upoly *up);
106 __isl_give struct isl_upoly *isl_upoly_mul(__isl_take struct isl_upoly *up1,
107 __isl_take struct isl_upoly *up2);
109 int isl_upoly_is_cst(__isl_keep struct isl_upoly *up);
110 int isl_upoly_is_zero(__isl_keep struct isl_upoly *up);
111 int isl_upoly_is_one(__isl_keep struct isl_upoly *up);
112 int isl_upoly_is_negone(__isl_keep struct isl_upoly *up);
113 __isl_keep struct isl_upoly_cst *isl_upoly_as_cst(__isl_keep struct isl_upoly *up);
114 __isl_keep struct isl_upoly_rec *isl_upoly_as_rec(__isl_keep struct isl_upoly *up);
116 __isl_give struct isl_upoly *isl_upoly_sum(__isl_take struct isl_upoly *up1,
117 __isl_take struct isl_upoly *up2);
118 __isl_give struct isl_upoly *isl_upoly_mul_isl_int(
119 __isl_take struct isl_upoly *up, isl_int v);
121 __isl_give isl_qpolynomial *isl_qpolynomial_alloc(__isl_take isl_space *dim,
122 unsigned n_div, __isl_take struct isl_upoly *up);
123 __isl_give isl_qpolynomial *isl_qpolynomial_cow(__isl_take isl_qpolynomial *qp);
124 __isl_give isl_qpolynomial *isl_qpolynomial_dup(__isl_keep isl_qpolynomial *qp);
126 __isl_give isl_qpolynomial *isl_qpolynomial_cst_on_domain(__isl_take isl_space *dim,
127 isl_int v);
128 __isl_give isl_qpolynomial *isl_qpolynomial_rat_cst_on_domain(
129 __isl_take isl_space *space, const isl_int n, const isl_int d);
130 __isl_give isl_qpolynomial *isl_qpolynomial_var_pow_on_domain(__isl_take isl_space *dim,
131 int pos, int power);
132 int isl_qpolynomial_is_one(__isl_keep isl_qpolynomial *qp);
133 int isl_qpolynomial_is_affine(__isl_keep isl_qpolynomial *qp);
134 int isl_qpolynomial_is_cst(__isl_keep isl_qpolynomial *qp,
135 isl_int *n, isl_int *d);
137 __isl_give isl_qpolynomial *isl_qpolynomial_add_on_domain(
138 __isl_keep isl_set *dom,
139 __isl_take isl_qpolynomial *qp1,
140 __isl_take isl_qpolynomial *qp2);
142 int isl_qpolynomial_degree(__isl_keep isl_qpolynomial *poly);
143 __isl_give isl_qpolynomial *isl_qpolynomial_coeff(
144 __isl_keep isl_qpolynomial *poly,
145 enum isl_dim_type type, unsigned pos, int deg);
147 __isl_give isl_vec *isl_qpolynomial_extract_affine(
148 __isl_keep isl_qpolynomial *qp);
149 __isl_give isl_qpolynomial *isl_qpolynomial_from_affine(__isl_take isl_space *dim,
150 isl_int *f, isl_int denom);
152 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_cow(
153 __isl_take isl_pw_qpolynomial *pwqp);
155 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_piece(
156 __isl_take isl_pw_qpolynomial *pwqp,
157 __isl_take isl_set *set, __isl_take isl_qpolynomial *qp);
158 int isl_pw_qpolynomial_is_one(__isl_keep isl_pw_qpolynomial *pwqp);
160 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_project_out(
161 __isl_take isl_pw_qpolynomial *pwqp,
162 enum isl_dim_type type, unsigned first, unsigned n);
164 __isl_give isl_val *isl_qpolynomial_opt_on_domain(
165 __isl_take isl_qpolynomial *qp, __isl_take isl_set *set, int max);
167 enum isl_fold isl_fold_type_negate(enum isl_fold type);
169 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_cow(
170 __isl_take isl_qpolynomial_fold *fold);
171 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_dup(
172 __isl_keep isl_qpolynomial_fold *fold);
174 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_cow(
175 __isl_take isl_pw_qpolynomial_fold *pwf);
177 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_add_on_domain(
178 __isl_keep isl_set *set,
179 __isl_take isl_qpolynomial_fold *fold1,
180 __isl_take isl_qpolynomial_fold *fold2);
181 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_fold_on_domain(
182 __isl_keep isl_set *set,
183 __isl_take isl_qpolynomial_fold *fold1,
184 __isl_take isl_qpolynomial_fold *fold2);
186 __isl_give isl_val *isl_qpolynomial_fold_opt_on_domain(
187 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_set *set, int max);
189 int isl_pw_qpolynomial_fold_covers(__isl_keep isl_pw_qpolynomial_fold *pwf1,
190 __isl_keep isl_pw_qpolynomial_fold *pwf2);
192 __isl_give isl_qpolynomial *isl_qpolynomial_morph_domain(
193 __isl_take isl_qpolynomial *qp, __isl_take isl_morph *morph);
194 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_morph_domain(
195 __isl_take isl_pw_qpolynomial *pwqp, __isl_take isl_morph *morph);
196 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_morph_domain(
197 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_morph *morph);
198 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_morph_domain(
199 __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_morph *morph);
201 __isl_give isl_qpolynomial *isl_qpolynomial_lift(__isl_take isl_qpolynomial *qp,
202 __isl_take isl_space *dim);
203 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_lift(
204 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_space *dim);
206 __isl_give isl_qpolynomial *isl_qpolynomial_substitute_equalities(
207 __isl_take isl_qpolynomial *qp, __isl_take isl_basic_set *eq);
208 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_substitute_equalities(
209 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_basic_set *eq);
210 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
211 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_set *context);
213 __isl_give isl_qpolynomial *isl_qpolynomial_realign_domain(
214 __isl_take isl_qpolynomial *qp, __isl_take isl_reordering *r);
215 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_realign_domain(
216 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_reordering *r);
217 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_realign_domain(
218 __isl_take isl_pw_qpolynomial *pwqp, __isl_take isl_reordering *r);
219 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_realign_domain(
220 __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_reordering *r);
222 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_reset_space(
223 __isl_take isl_pw_qpolynomial *pwqp, __isl_take isl_space *space);
224 __isl_give isl_qpolynomial *isl_qpolynomial_reset_domain_space(
225 __isl_take isl_qpolynomial *qp, __isl_take isl_space *dim);
226 __isl_give isl_qpolynomial *isl_qpolynomial_reset_space_and_domain(
227 __isl_take isl_qpolynomial *qp, __isl_take isl_space *space,
228 __isl_take isl_space *domain);
229 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_reset_domain_space(
230 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_space *dim);
231 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_reset_space_and_domain(
232 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_space *space,
233 __isl_take isl_space *domain);
234 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_reset_domain_space(
235 __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_space *dim);
237 void isl_qpolynomial_get_den(__isl_keep isl_qpolynomial *qp, isl_int *d);
238 __isl_give isl_qpolynomial *isl_qpolynomial_add_isl_int(
239 __isl_take isl_qpolynomial *qp, isl_int v);
240 __isl_give isl_qpolynomial *isl_qpolynomial_mul_isl_int(
241 __isl_take isl_qpolynomial *qp, isl_int v);
242 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul_isl_int(
243 __isl_take isl_pw_qpolynomial *pwqp, isl_int v);
245 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_mul_isl_int(
246 __isl_take isl_qpolynomial_fold *fold, isl_int v);
247 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_mul_isl_int(
248 __isl_take isl_pw_qpolynomial_fold *pwf, isl_int v);
249 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul_isl_int(
250 __isl_take isl_union_pw_qpolynomial *upwqp, isl_int v);
251 __isl_give isl_union_pw_qpolynomial_fold *
252 isl_union_pw_qpolynomial_fold_mul_isl_int(
253 __isl_take isl_union_pw_qpolynomial_fold *upwf, isl_int v);