isl_input.c: read_aff_domain: remove spurious vars_free on error path
[isl.git] / isl_polynomial_private.h
blob737073106e393a3e83f873719473e564bf6ade0b
1 #include <stdio.h>
2 #include <isl/map.h>
3 #include <isl/mat.h>
4 #include <isl_morph.h>
5 #include <isl/polynomial.h>
6 #include <isl_reordering.h>
8 struct isl_upoly {
9 int ref;
10 struct isl_ctx *ctx;
12 int var;
15 struct isl_upoly_cst {
16 struct isl_upoly up;
17 isl_int n;
18 isl_int d;
21 struct isl_upoly_rec {
22 struct isl_upoly up;
23 int n;
25 size_t size;
26 struct isl_upoly *p[];
29 /* dim represents the domain space.
31 struct isl_qpolynomial {
32 int ref;
34 isl_space *dim;
35 struct isl_mat *div;
36 struct isl_upoly *upoly;
39 struct isl_term {
40 int ref;
42 isl_int n;
43 isl_int d;
45 isl_space *dim;
46 struct isl_mat *div;
48 int pow[1];
51 struct isl_pw_qpolynomial_piece {
52 struct isl_set *set;
53 struct isl_qpolynomial *qp;
56 struct isl_pw_qpolynomial {
57 int ref;
59 isl_space *dim;
61 int n;
63 size_t size;
64 struct isl_pw_qpolynomial_piece p[1];
67 /* dim represents the domain space.
69 struct isl_qpolynomial_fold {
70 int ref;
72 enum isl_fold type;
73 isl_space *dim;
75 int n;
77 size_t size;
78 struct isl_qpolynomial *qp[1];
81 struct isl_pw_qpolynomial_fold_piece {
82 struct isl_set *set;
83 struct isl_qpolynomial_fold *fold;
86 struct isl_pw_qpolynomial_fold {
87 int ref;
89 enum isl_fold type;
90 isl_space *dim;
92 int n;
94 size_t size;
95 struct isl_pw_qpolynomial_fold_piece p[1];
98 __isl_give struct isl_upoly *isl_upoly_zero(struct isl_ctx *ctx);
99 __isl_give struct isl_upoly *isl_upoly_copy(__isl_keep struct isl_upoly *up);
100 __isl_give struct isl_upoly *isl_upoly_cow(__isl_take struct isl_upoly *up);
101 __isl_give struct isl_upoly *isl_upoly_dup(__isl_keep struct isl_upoly *up);
102 void isl_upoly_free(__isl_take struct isl_upoly *up);
103 __isl_give struct isl_upoly *isl_upoly_mul(__isl_take struct isl_upoly *up1,
104 __isl_take struct isl_upoly *up2);
106 int isl_upoly_is_cst(__isl_keep struct isl_upoly *up);
107 int isl_upoly_is_zero(__isl_keep struct isl_upoly *up);
108 int isl_upoly_is_one(__isl_keep struct isl_upoly *up);
109 int isl_upoly_is_negone(__isl_keep struct isl_upoly *up);
110 __isl_keep struct isl_upoly_cst *isl_upoly_as_cst(__isl_keep struct isl_upoly *up);
111 __isl_keep struct isl_upoly_rec *isl_upoly_as_rec(__isl_keep struct isl_upoly *up);
113 __isl_give struct isl_upoly *isl_upoly_sum(__isl_take struct isl_upoly *up1,
114 __isl_take struct isl_upoly *up2);
115 __isl_give struct isl_upoly *isl_upoly_mul_isl_int(
116 __isl_take struct isl_upoly *up, isl_int v);
118 __isl_give isl_qpolynomial *isl_qpolynomial_alloc(__isl_take isl_space *dim,
119 unsigned n_div, __isl_take struct isl_upoly *up);
120 __isl_give isl_qpolynomial *isl_qpolynomial_cow(__isl_take isl_qpolynomial *qp);
121 __isl_give isl_qpolynomial *isl_qpolynomial_dup(__isl_keep isl_qpolynomial *qp);
123 __isl_give isl_qpolynomial *isl_qpolynomial_cst_on_domain(__isl_take isl_space *dim,
124 isl_int v);
125 __isl_give isl_qpolynomial *isl_qpolynomial_var_pow_on_domain(__isl_take isl_space *dim,
126 int pos, int power);
127 int isl_qpolynomial_is_one(__isl_keep isl_qpolynomial *qp);
128 int isl_qpolynomial_is_affine(__isl_keep isl_qpolynomial *qp);
130 __isl_give isl_qpolynomial *isl_qpolynomial_add_on_domain(
131 __isl_keep isl_set *dom,
132 __isl_take isl_qpolynomial *qp1,
133 __isl_take isl_qpolynomial *qp2);
135 int isl_qpolynomial_le_cst(__isl_keep isl_qpolynomial *qp1,
136 __isl_keep isl_qpolynomial *qp2);
137 __isl_give isl_qpolynomial *isl_qpolynomial_max_cst(
138 __isl_take isl_qpolynomial *qp1, __isl_take isl_qpolynomial *qp2);
139 __isl_give isl_qpolynomial *isl_qpolynomial_min_cst(
140 __isl_take isl_qpolynomial *qp1, __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_qpolynomial *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_qpolynomial *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_qpolynomial *isl_qpolynomial_reset_domain_space(
223 __isl_take isl_qpolynomial *qp, __isl_take isl_space *dim);
224 __isl_give isl_qpolynomial *isl_qpolynomial_reset_space_and_domain(
225 __isl_take isl_qpolynomial *qp, __isl_take isl_space *space,
226 __isl_take isl_space *domain);
227 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_reset_domain_space(
228 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_space *dim);
229 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_reset_space_and_domain(
230 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_space *space,
231 __isl_take isl_space *domain);
232 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_reset_domain_space(
233 __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_space *dim);