1 #ifndef ISL_POLYNOMIAL_H
2 #define ISL_POLYNOMIAL_H
9 #include <isl_printer.h>
11 #if defined(__cplusplus)
15 struct isl_qpolynomial
;
16 typedef struct isl_qpolynomial isl_qpolynomial
;
18 isl_ctx
*isl_qpolynomial_get_ctx(__isl_keep isl_qpolynomial
*qp
);
20 __isl_give isl_qpolynomial
*isl_qpolynomial_zero(__isl_take isl_dim
*dim
);
21 __isl_give isl_qpolynomial
*isl_qpolynomial_infty(__isl_take isl_dim
*dim
);
22 __isl_give isl_qpolynomial
*isl_qpolynomial_nan(__isl_take isl_dim
*dim
);
23 __isl_give isl_qpolynomial
*isl_qpolynomial_rat_cst(__isl_take isl_dim
*dim
,
24 const isl_int n
, const isl_int d
);
25 __isl_give isl_qpolynomial
*isl_qpolynomial_div(__isl_take isl_div
*div
);
26 __isl_give isl_qpolynomial
*isl_qpolynomial_var(__isl_take isl_dim
*dim
,
27 enum isl_dim_type type
, unsigned pos
);
28 __isl_give isl_qpolynomial
*isl_qpolynomial_copy(__isl_keep isl_qpolynomial
*qp
);
29 void isl_qpolynomial_free(__isl_take isl_qpolynomial
*qp
);
31 int isl_qpolynomial_is_equal(__isl_keep isl_qpolynomial
*qp1
,
32 __isl_keep isl_qpolynomial
*qp2
);
33 int isl_qpolynomial_is_nan(__isl_keep isl_qpolynomial
*qp
);
34 int isl_qpolynomial_is_infty(__isl_keep isl_qpolynomial
*qp
);
35 int isl_qpolynomial_is_neginfty(__isl_keep isl_qpolynomial
*qp
);
36 int isl_qpolynomial_sgn(__isl_keep isl_qpolynomial
*qp
);
37 int isl_qpolynomial_is_cst(__isl_keep isl_qpolynomial
*qp
,
38 isl_int
*n
, isl_int
*d
);
39 void isl_qpolynomial_get_den(__isl_keep isl_qpolynomial
*qp
, isl_int
*d
);
41 __isl_give isl_qpolynomial
*isl_qpolynomial_neg(__isl_take isl_qpolynomial
*qp
);
42 __isl_give isl_qpolynomial
*isl_qpolynomial_add(__isl_take isl_qpolynomial
*qp1
,
43 __isl_take isl_qpolynomial
*qp2
);
44 __isl_give isl_qpolynomial
*isl_qpolynomial_mul(__isl_take isl_qpolynomial
*qp1
,
45 __isl_take isl_qpolynomial
*qp2
);
47 __isl_give isl_qpolynomial
*isl_qpolynomial_move_dims(
48 __isl_take isl_qpolynomial
*qp
,
49 enum isl_dim_type dst_type
, unsigned dst_pos
,
50 enum isl_dim_type src_type
, unsigned src_pos
, unsigned n
);
51 __isl_give isl_qpolynomial
*isl_qpolynomial_drop_dims(
52 __isl_take isl_qpolynomial
*qp
,
53 enum isl_dim_type type
, unsigned first
, unsigned n
);
56 typedef struct isl_term isl_term
;
58 isl_ctx
*isl_term_get_ctx(__isl_keep isl_term
*term
);
60 void isl_term_free(__isl_take isl_term
*term
);
62 unsigned isl_term_dim(__isl_keep isl_term
*term
, enum isl_dim_type type
);
63 void isl_term_get_num(__isl_keep isl_term
*term
, isl_int
*n
);
64 void isl_term_get_den(__isl_keep isl_term
*term
, isl_int
*d
);
65 int isl_term_get_exp(__isl_keep isl_term
*term
,
66 enum isl_dim_type type
, unsigned pos
);
67 __isl_give isl_div
*isl_term_get_div(__isl_keep isl_term
*term
, unsigned pos
);
69 int isl_qpolynomial_foreach_term(__isl_keep isl_qpolynomial
*qp
,
70 int (*fn
)(__isl_take isl_term
*term
, void *user
), void *user
);
72 __isl_give isl_qpolynomial
*isl_qpolynomial_eval(
73 __isl_take isl_qpolynomial
*qp
, __isl_take isl_point
*pnt
);
75 __isl_give isl_printer
*isl_printer_print_qpolynomial(
76 __isl_take isl_printer
*p
, __isl_keep isl_qpolynomial
*qp
);
77 void isl_qpolynomial_print(__isl_keep isl_qpolynomial
*qp
, FILE *out
,
78 unsigned output_format
);
80 struct isl_pw_qpolynomial
;
81 typedef struct isl_pw_qpolynomial isl_pw_qpolynomial
;
83 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_zero(__isl_take isl_dim
*dim
);
84 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_alloc(__isl_take isl_set
*set
,
85 __isl_take isl_qpolynomial
*qp
);
86 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_copy(
87 __isl_keep isl_pw_qpolynomial
*pwqp
);
88 void isl_pw_qpolynomial_free(__isl_take isl_pw_qpolynomial
*pwqp
);
90 int isl_pw_qpolynomial_is_zero(__isl_keep isl_pw_qpolynomial
*pwqp
);
92 __isl_give isl_dim
*isl_pw_qpolynomial_get_dim(
93 __isl_keep isl_pw_qpolynomial
*pwqp
);
94 unsigned isl_pw_qpolynomial_dim(__isl_keep isl_pw_qpolynomial
*pwqp
,
95 enum isl_dim_type type
);
96 int isl_pw_qpolynomial_involves_dims(__isl_keep isl_pw_qpolynomial
*pwqp
,
97 enum isl_dim_type type
, unsigned first
, unsigned n
);
99 __isl_give isl_set
*isl_pw_qpolynomial_domain(__isl_take isl_pw_qpolynomial
*pwqp
);
100 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_intersect_domain(
101 __isl_take isl_pw_qpolynomial
*pwpq
, __isl_take isl_set
*set
);
103 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_drop_dims(
104 __isl_take isl_pw_qpolynomial
*pwqp
,
105 enum isl_dim_type type
, unsigned first
, unsigned n
);
106 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_split_dims(
107 __isl_take isl_pw_qpolynomial
*pwqp
,
108 enum isl_dim_type type
, unsigned first
, unsigned n
);
110 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_add(
111 __isl_take isl_pw_qpolynomial
*pwqp1
,
112 __isl_take isl_pw_qpolynomial
*pwqp2
);
113 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_sub(
114 __isl_take isl_pw_qpolynomial
*pwqp1
,
115 __isl_take isl_pw_qpolynomial
*pwqp2
);
116 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_add_disjoint(
117 __isl_take isl_pw_qpolynomial
*pwqp1
,
118 __isl_take isl_pw_qpolynomial
*pwqp2
);
119 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_neg(
120 __isl_take isl_pw_qpolynomial
*pwqp
);
121 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_mul(
122 __isl_take isl_pw_qpolynomial
*pwqp1
,
123 __isl_take isl_pw_qpolynomial
*pwqp2
);
125 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_add_dims(
126 __isl_take isl_pw_qpolynomial
*pwqp
,
127 enum isl_dim_type type
, unsigned n
);
128 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_move(
129 __isl_take isl_pw_qpolynomial
*pwqp
,
130 enum isl_dim_type dst_type
, unsigned dst_pos
,
131 enum isl_dim_type src_type
, unsigned src_pos
, unsigned n
);
133 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_fix_dim(
134 __isl_take isl_pw_qpolynomial
*pwqp
,
135 enum isl_dim_type type
, unsigned n
, isl_int v
);
137 __isl_give isl_qpolynomial
*isl_pw_qpolynomial_eval(
138 __isl_take isl_pw_qpolynomial
*pwqp
, __isl_take isl_point
*pnt
);
140 __isl_give isl_qpolynomial
*isl_pw_qpolynomial_max(
141 __isl_take isl_pw_qpolynomial
*pwqp
);
142 __isl_give isl_qpolynomial
*isl_pw_qpolynomial_min(
143 __isl_take isl_pw_qpolynomial
*pwqp
);
145 int isl_pw_qpolynomial_foreach_piece(__isl_keep isl_pw_qpolynomial
*pwqp
,
146 int (*fn
)(__isl_take isl_set
*set
, __isl_take isl_qpolynomial
*qp
,
147 void *user
), void *user
);
148 int isl_pw_qpolynomial_foreach_lifted_piece(__isl_keep isl_pw_qpolynomial
*pwqp
,
149 int (*fn
)(__isl_take isl_set
*set
, __isl_take isl_qpolynomial
*qp
,
150 void *user
), void *user
);
152 __isl_give isl_printer
*isl_printer_print_pw_qpolynomial(
153 __isl_take isl_printer
*p
, __isl_keep isl_pw_qpolynomial
*pwqp
);
154 void isl_pw_qpolynomial_print(__isl_keep isl_pw_qpolynomial
*pwqp
, FILE *out
,
155 unsigned output_format
);
157 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_coalesce(
158 __isl_take isl_pw_qpolynomial
*pwqp
);
159 __isl_give isl_pw_qpolynomial
*isl_pw_qpolynomial_gist(
160 __isl_take isl_pw_qpolynomial
*pwqp
, __isl_take isl_set
*context
);
168 struct isl_qpolynomial_fold
;
169 typedef struct isl_qpolynomial_fold isl_qpolynomial_fold
;
171 __isl_give isl_qpolynomial_fold
*isl_qpolynomial_fold_empty(enum isl_fold type
,
172 __isl_take isl_dim
*dim
);
173 __isl_give isl_qpolynomial_fold
*isl_qpolynomial_fold_alloc(
174 enum isl_fold type
, __isl_take isl_qpolynomial
*qp
);
175 __isl_give isl_qpolynomial_fold
*isl_qpolynomial_fold_copy(
176 __isl_keep isl_qpolynomial_fold
*fold
);
177 void isl_qpolynomial_fold_free(__isl_take isl_qpolynomial_fold
*fold
);
179 int isl_qpolynomial_fold_is_empty(__isl_keep isl_qpolynomial_fold
*fold
);
180 int isl_qpolynomial_fold_is_equal(__isl_keep isl_qpolynomial_fold
*fold1
,
181 __isl_keep isl_qpolynomial_fold
*fold2
);
183 __isl_give isl_qpolynomial_fold
*isl_qpolynomial_fold_fold(
184 __isl_take isl_qpolynomial_fold
*fold1
,
185 __isl_take isl_qpolynomial_fold
*fold2
);
187 __isl_give isl_qpolynomial
*isl_qpolynomial_fold_eval(
188 __isl_take isl_qpolynomial_fold
*fold
, __isl_take isl_point
*pnt
);
190 void isl_qpolynomial_fold_print(__isl_keep isl_qpolynomial_fold
*fold
, FILE *out
,
191 unsigned output_format
);
193 struct isl_pw_qpolynomial_fold
;
194 typedef struct isl_pw_qpolynomial_fold isl_pw_qpolynomial_fold
;
196 isl_ctx
*isl_pw_qpolynomial_fold_get_ctx(__isl_keep isl_pw_qpolynomial_fold
*pwf
);
198 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_fold_from_pw_qpolynomial(
199 enum isl_fold type
, __isl_take isl_pw_qpolynomial
*pwqp
);
201 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_fold_alloc(
202 __isl_take isl_set
*set
, __isl_take isl_qpolynomial_fold
*fold
);
203 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_fold_copy(
204 __isl_keep isl_pw_qpolynomial_fold
*pwf
);
205 void isl_pw_qpolynomial_fold_free(__isl_take isl_pw_qpolynomial_fold
*pwf
);
207 __isl_give isl_dim
*isl_pw_qpolynomial_fold_get_dim(
208 __isl_keep isl_pw_qpolynomial_fold
*pwf
);
209 unsigned isl_pw_qpolynomial_fold_dim(__isl_keep isl_pw_qpolynomial_fold
*pwf
,
210 enum isl_dim_type type
);
212 size_t isl_pw_qpolynomial_fold_size(__isl_keep isl_pw_qpolynomial_fold
*pwf
);
214 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_fold_zero(
215 __isl_take isl_dim
*dim
);
217 __isl_give isl_set
*isl_pw_qpolynomial_fold_domain(
218 __isl_take isl_pw_qpolynomial_fold
*pwf
);
219 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_fold_intersect_domain(
220 __isl_take isl_pw_qpolynomial_fold
*pwf
, __isl_take isl_set
*set
);
222 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_fold_add(
223 __isl_take isl_pw_qpolynomial_fold
*pwf1
,
224 __isl_take isl_pw_qpolynomial_fold
*pwf2
);
225 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_fold_add_disjoint(
226 __isl_take isl_pw_qpolynomial_fold
*pwf1
,
227 __isl_take isl_pw_qpolynomial_fold
*pwf2
);
229 __isl_give isl_qpolynomial
*isl_pw_qpolynomial_fold_eval(
230 __isl_take isl_pw_qpolynomial_fold
*pwf
, __isl_take isl_point
*pnt
);
232 __isl_give isl_printer
*isl_printer_print_pw_qpolynomial_fold(
233 __isl_take isl_printer
*p
, __isl_keep isl_pw_qpolynomial_fold
*pwf
);
234 void isl_pw_qpolynomial_fold_print(__isl_keep isl_pw_qpolynomial_fold
*pwf
,
235 FILE *out
, unsigned output_format
);
237 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_fold_coalesce(
238 __isl_take isl_pw_qpolynomial_fold
*pwf
);
239 __isl_give isl_pw_qpolynomial_fold
*isl_pw_qpolynomial_fold_gist(
240 __isl_take isl_pw_qpolynomial_fold
*pwf
, __isl_take isl_set
*context
);
242 __isl_give isl_qpolynomial
*isl_pw_qpolynomial_fold_max(
243 __isl_take isl_pw_qpolynomial_fold
*pwf
);
244 __isl_give isl_qpolynomial
*isl_pw_qpolynomial_fold_min(
245 __isl_take isl_pw_qpolynomial_fold
*pwf
);
247 #if defined(__cplusplus)