1 #ifndef ISL_POLYNOMIAL_H
2 #define ISL_POLYNOMIAL_H
5 #include <isl_constraint.h>
10 #include <isl_printer.h>
12 #if defined(__cplusplus)
16 struct isl_qpolynomial
;
17 typedef struct isl_qpolynomial isl_qpolynomial
;
19 isl_ctx
*isl_qpolynomial_get_ctx(__isl_keep isl_qpolynomial
*qp
);
20 __isl_give isl_dim
*isl_qpolynomial_get_dim(__isl_keep isl_qpolynomial
*qp
);
22 __isl_give isl_qpolynomial
*isl_qpolynomial_zero(__isl_take isl_dim
*dim
);
23 __isl_give isl_qpolynomial
*isl_qpolynomial_infty(__isl_take isl_dim
*dim
);
24 __isl_give isl_qpolynomial
*isl_qpolynomial_neginfty(__isl_take isl_dim
*dim
);
25 __isl_give isl_qpolynomial
*isl_qpolynomial_nan(__isl_take isl_dim
*dim
);
26 __isl_give isl_qpolynomial
*isl_qpolynomial_rat_cst(__isl_take isl_dim
*dim
,
27 const isl_int n
, const isl_int d
);
28 __isl_give isl_qpolynomial
*isl_qpolynomial_div(__isl_take isl_div
*div
);
29 __isl_give isl_qpolynomial
*isl_qpolynomial_var(__isl_take isl_dim
*dim
,
30 enum isl_dim_type type
, unsigned pos
);
31 __isl_give isl_qpolynomial
*isl_qpolynomial_copy(__isl_keep isl_qpolynomial
*qp
);
32 void isl_qpolynomial_free(__isl_take isl_qpolynomial
*qp
);
34 int isl_qpolynomial_is_equal(__isl_keep isl_qpolynomial
*qp1
,
35 __isl_keep isl_qpolynomial
*qp2
);
36 int isl_qpolynomial_is_nan(__isl_keep isl_qpolynomial
*qp
);
37 int isl_qpolynomial_is_infty(__isl_keep isl_qpolynomial
*qp
);
38 int isl_qpolynomial_is_neginfty(__isl_keep isl_qpolynomial
*qp
);
39 int isl_qpolynomial_sgn(__isl_keep isl_qpolynomial
*qp
);
40 int isl_qpolynomial_is_cst(__isl_keep isl_qpolynomial
*qp
,
41 isl_int
*n
, isl_int
*d
);
42 void isl_qpolynomial_get_den(__isl_keep isl_qpolynomial
*qp
, isl_int
*d
);
44 __isl_give isl_qpolynomial
*isl_qpolynomial_neg(__isl_take isl_qpolynomial
*qp
);
45 __isl_give isl_qpolynomial
*isl_qpolynomial_add(__isl_take isl_qpolynomial
*qp1
,
46 __isl_take isl_qpolynomial
*qp2
);
47 __isl_give isl_qpolynomial
*isl_qpolynomial_sub(__isl_take isl_qpolynomial
*qp1
,
48 __isl_take isl_qpolynomial
*qp2
);
49 __isl_give isl_qpolynomial
*isl_qpolynomial_mul(__isl_take isl_qpolynomial
*qp1
,
50 __isl_take isl_qpolynomial
*qp2
);
52 __isl_give isl_qpolynomial
*isl_qpolynomial_move_dims(
53 __isl_take isl_qpolynomial
*qp
,
54 enum isl_dim_type dst_type
, unsigned dst_pos
,
55 enum isl_dim_type src_type
, unsigned src_pos
, unsigned n
);
56 __isl_give isl_qpolynomial
*isl_qpolynomial_drop_dims(
57 __isl_take isl_qpolynomial
*qp
,
58 enum isl_dim_type type
, unsigned first
, unsigned n
);
60 __isl_give isl_qpolynomial
*isl_qpolynomial_substitute(
61 __isl_take isl_qpolynomial
*qp
,
62 enum isl_dim_type type
, unsigned first
, unsigned n
,
63 __isl_keep isl_qpolynomial
**subs
);
65 int isl_qpolynomial_as_polynomial_on_domain(__isl_keep isl_qpolynomial
*qp
,
66 __isl_keep isl_basic_set
*bset
,
67 int (*fn
)(__isl_take isl_basic_set
*bset
,
68 __isl_take isl_qpolynomial
*poly
, void *user
), void *user
);
71 typedef struct isl_term isl_term
;
73 isl_ctx
*isl_term_get_ctx(__isl_keep isl_term
*term
);
75 void isl_term_free(__isl_take isl_term
*term
);
77 unsigned isl_term_dim(__isl_keep isl_term
*term
, enum isl_dim_type type
);
78 void isl_term_get_num(__isl_keep isl_term
*term
, isl_int
*n
);
79 void isl_term_get_den(__isl_keep isl_term
*term
, isl_int
*d
);
80 int isl_term_get_exp(__isl_keep isl_term
*term
,
81 enum isl_dim_type type
, unsigned pos
);
82 __isl_give isl_div
*isl_term_get_div(__isl_keep isl_term
*term
, unsigned pos
);
84 int isl_qpolynomial_foreach_term(__isl_keep isl_qpolynomial
*qp
,
85 int (*fn
)(__isl_take isl_term
*term
, void *user
), void *user
);
87 __isl_give isl_qpolynomial
*isl_qpolynomial_eval(
88 __isl_take isl_qpolynomial
*qp
, __isl_take isl_point
*pnt
);
90 __isl_give isl_qpolynomial
*isl_qpolynomial_from_constraint(
91 __isl_take isl_constraint
*c
, enum isl_dim_type type
, unsigned pos
);
92 __isl_give isl_qpolynomial
*isl_qpolynomial_from_term(__isl_take isl_term
*term
);
94 __isl_give isl_printer
*isl_printer_print_qpolynomial(
95 __isl_take isl_printer
*p
, __isl_keep isl_qpolynomial
*qp
);
96 void isl_qpolynomial_print(__isl_keep isl_qpolynomial
*qp
, FILE *out
,
97 unsigned output_format
);
99 struct isl_pw_qpolynomial
;
100 typedef struct isl_pw_qpolynomial isl_pw_qpolynomial
;
102 isl_ctx
*isl_pw_qpolynomial_get_ctx(__isl_keep isl_pw_qpolynomial
*pwqp
);
104 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_zero(__isl_take isl_dim
*dim
);
105 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_alloc(__isl_take isl_set
*set
,
106 __isl_take isl_qpolynomial
*qp
);
107 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_copy(
108 __isl_keep isl_pw_qpolynomial
*pwqp
);
109 void isl_pw_qpolynomial_free(__isl_take isl_pw_qpolynomial
*pwqp
);
111 int isl_pw_qpolynomial_is_zero(__isl_keep isl_pw_qpolynomial
*pwqp
);
113 __isl_give isl_dim
*isl_pw_qpolynomial_get_dim(
114 __isl_keep isl_pw_qpolynomial
*pwqp
);
115 unsigned isl_pw_qpolynomial_dim(__isl_keep isl_pw_qpolynomial
*pwqp
,
116 enum isl_dim_type type
);
117 int isl_pw_qpolynomial_involves_dims(__isl_keep isl_pw_qpolynomial
*pwqp
,
118 enum isl_dim_type type
, unsigned first
, unsigned n
);
120 __isl_give isl_set
*isl_pw_qpolynomial_domain(__isl_take isl_pw_qpolynomial
*pwqp
);
121 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_intersect_domain(
122 __isl_take isl_pw_qpolynomial
*pwpq
, __isl_take isl_set
*set
);
124 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_drop_dims(
125 __isl_take isl_pw_qpolynomial
*pwqp
,
126 enum isl_dim_type type
, unsigned first
, unsigned n
);
127 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_split_dims(
128 __isl_take isl_pw_qpolynomial
*pwqp
,
129 enum isl_dim_type type
, unsigned first
, unsigned n
);
131 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_add(
132 __isl_take isl_pw_qpolynomial
*pwqp1
,
133 __isl_take isl_pw_qpolynomial
*pwqp2
);
134 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_sub(
135 __isl_take isl_pw_qpolynomial
*pwqp1
,
136 __isl_take isl_pw_qpolynomial
*pwqp2
);
137 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_add_disjoint(
138 __isl_take isl_pw_qpolynomial
*pwqp1
,
139 __isl_take isl_pw_qpolynomial
*pwqp2
);
140 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_neg(
141 __isl_take isl_pw_qpolynomial
*pwqp
);
142 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_mul(
143 __isl_take isl_pw_qpolynomial
*pwqp1
,
144 __isl_take isl_pw_qpolynomial
*pwqp2
);
146 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_add_dims(
147 __isl_take isl_pw_qpolynomial
*pwqp
,
148 enum isl_dim_type type
, unsigned n
);
149 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_move_dims(
150 __isl_take isl_pw_qpolynomial
*pwqp
,
151 enum isl_dim_type dst_type
, unsigned dst_pos
,
152 enum isl_dim_type src_type
, unsigned src_pos
, unsigned n
);
154 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_fix_dim(
155 __isl_take isl_pw_qpolynomial
*pwqp
,
156 enum isl_dim_type type
, unsigned n
, isl_int v
);
158 __isl_give isl_qpolynomial
*isl_pw_qpolynomial_eval(
159 __isl_take isl_pw_qpolynomial
*pwqp
, __isl_take isl_point
*pnt
);
161 __isl_give isl_qpolynomial
*isl_pw_qpolynomial_max(
162 __isl_take isl_pw_qpolynomial
*pwqp
);
163 __isl_give isl_qpolynomial
*isl_pw_qpolynomial_min(
164 __isl_take isl_pw_qpolynomial
*pwqp
);
166 int isl_pw_qpolynomial_foreach_piece(__isl_keep isl_pw_qpolynomial
*pwqp
,
167 int (*fn
)(__isl_take isl_set
*set
, __isl_take isl_qpolynomial
*qp
,
168 void *user
), void *user
);
169 int isl_pw_qpolynomial_foreach_lifted_piece(__isl_keep isl_pw_qpolynomial
*pwqp
,
170 int (*fn
)(__isl_take isl_set
*set
, __isl_take isl_qpolynomial
*qp
,
171 void *user
), void *user
);
173 __isl_give isl_printer
*isl_printer_print_pw_qpolynomial(
174 __isl_take isl_printer
*p
, __isl_keep isl_pw_qpolynomial
*pwqp
);
175 void isl_pw_qpolynomial_print(__isl_keep isl_pw_qpolynomial
*pwqp
, FILE *out
,
176 unsigned output_format
);
178 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_coalesce(
179 __isl_take isl_pw_qpolynomial
*pwqp
);
180 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_gist(
181 __isl_take isl_pw_qpolynomial
*pwqp
, __isl_take isl_set
*context
);
189 struct isl_qpolynomial_fold
;
190 typedef struct isl_qpolynomial_fold isl_qpolynomial_fold
;
192 enum isl_fold
isl_qpolynomial_fold_get_type(__isl_keep isl_qpolynomial_fold
*fold
);
194 __isl_give isl_qpolynomial_fold
*isl_qpolynomial_fold_empty(enum isl_fold type
,
195 __isl_take isl_dim
*dim
);
196 __isl_give isl_qpolynomial_fold
*isl_qpolynomial_fold_alloc(
197 enum isl_fold type
, __isl_take isl_qpolynomial
*qp
);
198 __isl_give isl_qpolynomial_fold
*isl_qpolynomial_fold_copy(
199 __isl_keep isl_qpolynomial_fold
*fold
);
200 void isl_qpolynomial_fold_free(__isl_take isl_qpolynomial_fold
*fold
);
202 int isl_qpolynomial_fold_is_empty(__isl_keep isl_qpolynomial_fold
*fold
);
203 int isl_qpolynomial_fold_is_equal(__isl_keep isl_qpolynomial_fold
*fold1
,
204 __isl_keep isl_qpolynomial_fold
*fold2
);
206 __isl_give isl_qpolynomial_fold
*isl_qpolynomial_fold_fold(
207 __isl_take isl_qpolynomial_fold
*fold1
,
208 __isl_take isl_qpolynomial_fold
*fold2
);
210 __isl_give isl_qpolynomial_fold
*isl_qpolynomial_fold_move_dims(
211 __isl_take isl_qpolynomial_fold
*fold
,
212 enum isl_dim_type dst_type
, unsigned dst_pos
,
213 enum isl_dim_type src_type
, unsigned src_pos
, unsigned n
);
215 __isl_give isl_qpolynomial
*isl_qpolynomial_fold_eval(
216 __isl_take isl_qpolynomial_fold
*fold
, __isl_take isl_point
*pnt
);
218 void isl_qpolynomial_fold_print(__isl_keep isl_qpolynomial_fold
*fold
, FILE *out
,
219 unsigned output_format
);
221 struct isl_pw_qpolynomial_fold
;
222 typedef struct isl_pw_qpolynomial_fold isl_pw_qpolynomial_fold
;
224 isl_ctx
*isl_pw_qpolynomial_fold_get_ctx(__isl_keep isl_pw_qpolynomial_fold
*pwf
);
226 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_fold_from_pw_qpolynomial(
227 enum isl_fold type
, __isl_take isl_pw_qpolynomial
*pwqp
);
229 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_fold_alloc(
230 __isl_take isl_set
*set
, __isl_take isl_qpolynomial_fold
*fold
);
231 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_fold_copy(
232 __isl_keep isl_pw_qpolynomial_fold
*pwf
);
233 void isl_pw_qpolynomial_fold_free(__isl_take isl_pw_qpolynomial_fold
*pwf
);
235 int isl_pw_qpolynomial_fold_is_zero(__isl_keep isl_pw_qpolynomial_fold
*pwf
);
237 __isl_give isl_dim
*isl_pw_qpolynomial_fold_get_dim(
238 __isl_keep isl_pw_qpolynomial_fold
*pwf
);
239 unsigned isl_pw_qpolynomial_fold_dim(__isl_keep isl_pw_qpolynomial_fold
*pwf
,
240 enum isl_dim_type type
);
242 size_t isl_pw_qpolynomial_fold_size(__isl_keep isl_pw_qpolynomial_fold
*pwf
);
244 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_fold_zero(
245 __isl_take isl_dim
*dim
);
247 __isl_give isl_set
*isl_pw_qpolynomial_fold_domain(
248 __isl_take isl_pw_qpolynomial_fold
*pwf
);
249 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_fold_intersect_domain(
250 __isl_take isl_pw_qpolynomial_fold
*pwf
, __isl_take isl_set
*set
);
252 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_fold_add(
253 __isl_take isl_pw_qpolynomial_fold
*pwf1
,
254 __isl_take isl_pw_qpolynomial_fold
*pwf2
);
255 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_fold_add_disjoint(
256 __isl_take isl_pw_qpolynomial_fold
*pwf1
,
257 __isl_take isl_pw_qpolynomial_fold
*pwf2
);
259 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_fold_move_dims(
260 __isl_take isl_pw_qpolynomial_fold
*pwf
,
261 enum isl_dim_type dst_type
, unsigned dst_pos
,
262 enum isl_dim_type src_type
, unsigned src_pos
, unsigned n
);
264 __isl_give isl_qpolynomial
*isl_pw_qpolynomial_fold_eval(
265 __isl_take isl_pw_qpolynomial_fold
*pwf
, __isl_take isl_point
*pnt
);
267 int isl_pw_qpolynomial_fold_foreach_lifted_piece(
268 __isl_keep isl_pw_qpolynomial_fold
*pwf
,
269 int (*fn
)(__isl_take isl_set
*set
, __isl_take isl_qpolynomial_fold
*fold
,
270 void *user
), void *user
);
272 __isl_give isl_printer
*isl_printer_print_pw_qpolynomial_fold(
273 __isl_take isl_printer
*p
, __isl_keep isl_pw_qpolynomial_fold
*pwf
);
274 void isl_pw_qpolynomial_fold_print(__isl_keep isl_pw_qpolynomial_fold
*pwf
,
275 FILE *out
, unsigned output_format
);
277 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_fold_coalesce(
278 __isl_take isl_pw_qpolynomial_fold
*pwf
);
279 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_fold_gist(
280 __isl_take isl_pw_qpolynomial_fold
*pwf
, __isl_take isl_set
*context
);
282 __isl_give isl_qpolynomial
*isl_pw_qpolynomial_fold_max(
283 __isl_take isl_pw_qpolynomial_fold
*pwf
);
284 __isl_give isl_qpolynomial
*isl_pw_qpolynomial_fold_min(
285 __isl_take isl_pw_qpolynomial_fold
*pwf
);
287 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_bound_range(
288 __isl_take isl_pw_qpolynomial
*pwqp
, enum isl_fold type
, int *exact
);
290 #if defined(__cplusplus)