6 #include <isl/polynomial.h>
7 #include <isl_reordering.h>
8 #include "isl_list_private.h"
16 typedef struct isl_poly isl_poly
;
23 typedef struct isl_poly_cst isl_poly_cst
;
32 typedef struct isl_poly_rec isl_poly_rec
;
34 /* dim represents the domain space.
36 struct isl_qpolynomial
{
45 #define EL isl_qpolynomial
47 #include <isl_list_templ.h>
61 struct isl_pw_qpolynomial_piece
{
63 struct isl_qpolynomial
*qp
;
66 struct isl_pw_qpolynomial
{
74 struct isl_pw_qpolynomial_piece p
[1];
78 #define PW isl_pw_qpolynomial
80 #include <isl_pw_templ.h>
83 #define EL isl_pw_qpolynomial
85 #include <isl_list_templ.h>
87 /* dim represents the domain space.
89 struct isl_qpolynomial_fold
{
95 isl_qpolynomial_list
*list
;
98 struct isl_pw_qpolynomial_fold_piece
{
100 struct isl_qpolynomial_fold
*fold
;
103 struct isl_pw_qpolynomial_fold
{
112 struct isl_pw_qpolynomial_fold_piece p
[1];
116 #define PW isl_pw_qpolynomial_fold
118 #include <isl_pw_templ.h>
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
,
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
,
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_keep isl_qpolynomial
*isl_pw_qpolynomial_peek_base_at(
190 __isl_keep isl_pw_qpolynomial
*pwqp
, int pos
);
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
);
195 int isl_pw_qpolynomial_is_one(__isl_keep isl_pw_qpolynomial
*pwqp
);
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
);
201 __isl_give isl_val
*isl_qpolynomial_opt_on_domain(
202 __isl_take isl_qpolynomial
*qp
, __isl_take isl_set
*set
, int max
);
204 enum isl_fold
isl_fold_type_negate(enum isl_fold type
);
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
);
211 __isl_keep isl_qpolynomial_list
*isl_qpolynomial_fold_peek_list(
212 __isl_keep isl_qpolynomial_fold
*fold
);
214 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_fold_cow(
215 __isl_take isl_pw_qpolynomial_fold
*pwf
);
217 __isl_keep isl_qpolynomial_fold
*isl_pw_qpolynomial_fold_peek_base_at(
218 __isl_keep isl_pw_qpolynomial_fold
*pwf
, int pos
);
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
);
229 int isl_qpolynomial_fold_plain_cmp(__isl_keep isl_qpolynomial_fold
*fold1
,
230 __isl_keep isl_qpolynomial_fold
*fold2
);
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
);
235 isl_bool
isl_pw_qpolynomial_fold_covers(
236 __isl_keep isl_pw_qpolynomial_fold
*pwf1
,
237 __isl_keep isl_pw_qpolynomial_fold
*pwf2
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
292 ISL_DECLARE_LIST_FN_PRIVATE(qpolynomial
)