isl_tab_pip.c: correctly detect non-negativity of divs in lexmin contexts
[isl.git] / isl_polynomial_private.h
blob45e328a2c1abf0fcabe75e6eef394adf6bba6c4e
1 #include <stdio.h>
2 #include <isl/div.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[1];
30 struct isl_qpolynomial {
31 int ref;
33 struct isl_dim *dim;
34 struct isl_mat *div;
35 struct isl_upoly *upoly;
38 struct isl_term {
39 int ref;
41 isl_int n;
42 isl_int d;
44 struct isl_dim *dim;
45 struct isl_mat *div;
47 int pow[1];
50 struct isl_pw_qpolynomial_piece {
51 struct isl_set *set;
52 struct isl_qpolynomial *qp;
55 struct isl_pw_qpolynomial {
56 int ref;
58 struct isl_dim *dim;
60 int n;
62 size_t size;
63 struct isl_pw_qpolynomial_piece p[1];
66 struct isl_qpolynomial_fold {
67 int ref;
69 enum isl_fold type;
70 struct isl_dim *dim;
72 int n;
74 size_t size;
75 struct isl_qpolynomial *qp[1];
78 struct isl_pw_qpolynomial_fold_piece {
79 struct isl_set *set;
80 struct isl_qpolynomial_fold *fold;
83 struct isl_pw_qpolynomial_fold {
84 int ref;
86 enum isl_fold type;
87 struct isl_dim *dim;
89 int n;
91 size_t size;
92 struct isl_pw_qpolynomial_fold_piece p[1];
95 __isl_give struct isl_upoly *isl_upoly_zero(struct isl_ctx *ctx);
96 __isl_give struct isl_upoly *isl_upoly_copy(__isl_keep struct isl_upoly *up);
97 __isl_give struct isl_upoly *isl_upoly_cow(__isl_take struct isl_upoly *up);
98 __isl_give struct isl_upoly *isl_upoly_dup(__isl_keep struct isl_upoly *up);
99 void isl_upoly_free(__isl_take struct isl_upoly *up);
100 __isl_give struct isl_upoly *isl_upoly_mul(__isl_take struct isl_upoly *up1,
101 __isl_take struct isl_upoly *up2);
103 int isl_upoly_is_cst(__isl_keep struct isl_upoly *up);
104 int isl_upoly_is_zero(__isl_keep struct isl_upoly *up);
105 int isl_upoly_is_one(__isl_keep struct isl_upoly *up);
106 int isl_upoly_is_negone(__isl_keep struct isl_upoly *up);
107 __isl_keep struct isl_upoly_cst *isl_upoly_as_cst(__isl_keep struct isl_upoly *up);
108 __isl_keep struct isl_upoly_rec *isl_upoly_as_rec(__isl_keep struct isl_upoly *up);
110 __isl_give struct isl_upoly *isl_upoly_sum(__isl_take struct isl_upoly *up1,
111 __isl_take struct isl_upoly *up2);
112 __isl_give struct isl_upoly *isl_upoly_neg(__isl_take struct isl_upoly *up);
114 __isl_give isl_qpolynomial *isl_qpolynomial_alloc(__isl_take isl_dim *dim,
115 unsigned n_div, __isl_take struct isl_upoly *up);
116 __isl_give isl_qpolynomial *isl_qpolynomial_cow(__isl_take isl_qpolynomial *qp);
117 __isl_give isl_qpolynomial *isl_qpolynomial_dup(__isl_keep isl_qpolynomial *qp);
119 __isl_give isl_qpolynomial *isl_qpolynomial_cst(__isl_take isl_dim *dim,
120 isl_int v);
121 __isl_give isl_qpolynomial *isl_qpolynomial_var_pow(__isl_take isl_dim *dim,
122 int pos, int power);
123 __isl_give isl_qpolynomial *isl_qpolynomial_div_pow(__isl_take isl_div *div,
124 int power);
125 int isl_qpolynomial_is_one(__isl_keep isl_qpolynomial *qp);
126 int isl_qpolynomial_is_affine(__isl_keep isl_qpolynomial *qp);
128 __isl_give isl_qpolynomial *isl_qpolynomial_add_on_domain(
129 __isl_keep isl_set *dom,
130 __isl_take isl_qpolynomial *qp1,
131 __isl_take isl_qpolynomial *qp2);
133 int isl_qpolynomial_le_cst(__isl_keep isl_qpolynomial *qp1,
134 __isl_keep isl_qpolynomial *qp2);
135 __isl_give isl_qpolynomial *isl_qpolynomial_max_cst(
136 __isl_take isl_qpolynomial *qp1, __isl_take isl_qpolynomial *qp2);
137 __isl_give isl_qpolynomial *isl_qpolynomial_min_cst(
138 __isl_take isl_qpolynomial *qp1, __isl_take isl_qpolynomial *qp2);
140 int isl_qpolynomial_degree(__isl_keep isl_qpolynomial *poly);
141 __isl_give isl_qpolynomial *isl_qpolynomial_coeff(
142 __isl_keep isl_qpolynomial *poly,
143 enum isl_dim_type type, unsigned pos, int deg);
145 __isl_give isl_vec *isl_qpolynomial_extract_affine(
146 __isl_keep isl_qpolynomial *qp);
147 __isl_give isl_qpolynomial *isl_qpolynomial_from_affine(__isl_take isl_dim *dim,
148 isl_int *f, isl_int denom);
150 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_cow(
151 __isl_take isl_pw_qpolynomial *pwqp);
153 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_piece(
154 __isl_take isl_pw_qpolynomial *pwqp,
155 __isl_take isl_set *set, __isl_take isl_qpolynomial *qp);
156 int isl_pw_qpolynomial_is_one(__isl_keep isl_pw_qpolynomial *pwqp);
158 __isl_give isl_qpolynomial *isl_qpolynomial_opt_on_domain(
159 __isl_take isl_qpolynomial *qp, __isl_take isl_set *set, int max);
161 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_cow(
162 __isl_take isl_qpolynomial_fold *fold);
163 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_dup(
164 __isl_keep isl_qpolynomial_fold *fold);
166 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_cow(
167 __isl_take isl_pw_qpolynomial_fold *pwf);
169 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_add_on_domain(
170 __isl_keep isl_set *set,
171 __isl_take isl_qpolynomial_fold *fold1,
172 __isl_take isl_qpolynomial_fold *fold2);
173 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_fold_on_domain(
174 __isl_keep isl_set *set,
175 __isl_take isl_qpolynomial_fold *fold1,
176 __isl_take isl_qpolynomial_fold *fold2);
178 __isl_give isl_qpolynomial *isl_qpolynomial_fold_opt_on_domain(
179 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_set *set, int max);
181 int isl_pw_qpolynomial_fold_covers(__isl_keep isl_pw_qpolynomial_fold *pwf1,
182 __isl_keep isl_pw_qpolynomial_fold *pwf2);
184 __isl_give isl_qpolynomial *isl_qpolynomial_morph(__isl_take isl_qpolynomial *qp,
185 __isl_take isl_morph *morph);
186 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_morph(
187 __isl_take isl_pw_qpolynomial *pwqp, __isl_take isl_morph *morph);
188 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_morph(
189 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_morph *morph);
190 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_morph(
191 __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_morph *morph);
193 __isl_give isl_qpolynomial *isl_qpolynomial_lift(__isl_take isl_qpolynomial *qp,
194 __isl_take isl_dim *dim);
195 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_lift(
196 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_dim *dim);
198 __isl_give isl_qpolynomial *isl_qpolynomial_substitute_equalities(
199 __isl_take isl_qpolynomial *qp, __isl_take isl_basic_set *eq);
200 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_substitute_equalities(
201 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_basic_set *eq);
202 __isl_give isl_qpolynomial *isl_qpolynomial_gist(
203 __isl_take isl_qpolynomial *qp, __isl_take isl_set *context);
204 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
205 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_set *context);
207 __isl_give isl_qpolynomial *isl_qpolynomial_realign(
208 __isl_take isl_qpolynomial *qp, __isl_take isl_reordering *r);
209 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_realign(
210 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_reordering *r);
211 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_realign(
212 __isl_take isl_pw_qpolynomial *pwqp, __isl_take isl_reordering *r);
213 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_realign(
214 __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_reordering *r);