add isl_pw_qpolynomial_involves_dims
[platform/upstream/isl.git] / include / isl_polynomial.h
1 #ifndef ISL_POLYNOMIAL_H
2 #define ISL_POLYNOMIAL_H
3
4 #include <isl_ctx.h>
5 #include <isl_dim.h>
6 #include <isl_div.h>
7 #include <isl_set.h>
8 #include <isl_point.h>
9 #include <isl_printer.h>
10
11 #if defined(__cplusplus)
12 extern "C" {
13 #endif
14
15 struct isl_qpolynomial;
16 typedef struct isl_qpolynomial isl_qpolynomial;
17
18 __isl_give isl_qpolynomial *isl_qpolynomial_zero(__isl_take isl_dim *dim);
19 __isl_give isl_qpolynomial *isl_qpolynomial_infty(__isl_take isl_dim *dim);
20 __isl_give isl_qpolynomial *isl_qpolynomial_nan(__isl_take isl_dim *dim);
21 __isl_give isl_qpolynomial *isl_qpolynomial_rat_cst(__isl_take isl_dim *dim,
22         const isl_int n, const isl_int d);
23 __isl_give isl_qpolynomial *isl_qpolynomial_div(__isl_take isl_div *div);
24 __isl_give isl_qpolynomial *isl_qpolynomial_var(__isl_take isl_dim *dim,
25         enum isl_dim_type type, unsigned pos);
26 __isl_give isl_qpolynomial *isl_qpolynomial_copy(__isl_keep isl_qpolynomial *qp);
27 void isl_qpolynomial_free(__isl_take isl_qpolynomial *qp);
28
29 int isl_qpolynomial_is_equal(__isl_keep isl_qpolynomial *qp1,
30         __isl_keep isl_qpolynomial *qp2);
31 int isl_qpolynomial_is_cst(__isl_keep isl_qpolynomial *qp,
32         isl_int *n, isl_int *d);
33 void isl_qpolynomial_get_den(__isl_keep isl_qpolynomial *qp, isl_int *d);
34
35 __isl_give isl_qpolynomial *isl_qpolynomial_neg(__isl_take isl_qpolynomial *qp);
36 __isl_give isl_qpolynomial *isl_qpolynomial_add(__isl_take isl_qpolynomial *qp1,
37         __isl_take isl_qpolynomial *qp2);
38 __isl_give isl_qpolynomial *isl_qpolynomial_mul(__isl_take isl_qpolynomial *qp1,
39         __isl_take isl_qpolynomial *qp2);
40
41 struct isl_term;
42 typedef struct isl_term isl_term;
43
44 isl_ctx *isl_term_get_ctx(__isl_keep isl_term *term);
45
46 void isl_term_free(__isl_take isl_term *term);
47
48 unsigned isl_term_dim(__isl_keep isl_term *term, enum isl_dim_type type);
49 void isl_term_get_num(__isl_keep isl_term *term, isl_int *n);
50 void isl_term_get_den(__isl_keep isl_term *term, isl_int *d);
51 int isl_term_get_exp(__isl_keep isl_term *term,
52         enum isl_dim_type type, unsigned pos);
53 __isl_give isl_div *isl_term_get_div(__isl_keep isl_term *term, unsigned pos);
54
55 int isl_qpolynomial_foreach_term(__isl_keep isl_qpolynomial *qp,
56         int (*fn)(__isl_take isl_term *term, void *user), void *user);
57
58 __isl_give isl_qpolynomial *isl_qpolynomial_eval(
59         __isl_take isl_qpolynomial *qp, __isl_take isl_point *pnt);
60
61 __isl_give isl_printer *isl_printer_print_qpolynomial(
62         __isl_take isl_printer *p, __isl_keep isl_qpolynomial *qp);
63 void isl_qpolynomial_print(__isl_keep isl_qpolynomial *qp, FILE *out,
64         unsigned output_format);
65
66 struct isl_pw_qpolynomial;
67 typedef struct isl_pw_qpolynomial isl_pw_qpolynomial;
68
69 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(__isl_take isl_dim *dim);
70 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(__isl_take isl_set *set,
71         __isl_take isl_qpolynomial *qp);
72 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
73         __isl_keep isl_pw_qpolynomial *pwqp);
74 void isl_pw_qpolynomial_free(__isl_take isl_pw_qpolynomial *pwqp);
75
76 __isl_give isl_dim *isl_pw_qpolynomial_get_dim(
77         __isl_keep isl_pw_qpolynomial *pwqp);
78 unsigned isl_pw_qpolynomial_dim(__isl_keep isl_pw_qpolynomial *pwqp,
79         enum isl_dim_type type);
80 int isl_pw_qpolynomial_involves_dims(__isl_keep isl_pw_qpolynomial *pwqp,
81         enum isl_dim_type type, unsigned first, unsigned n);
82
83 __isl_give isl_set *isl_pw_qpolynomial_domain(__isl_take isl_pw_qpolynomial *pwqp);
84 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_intersect_domain(
85         __isl_take isl_pw_qpolynomial *pwpq, __isl_take isl_set *set);
86
87 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
88         __isl_take isl_pw_qpolynomial *pwqp1,
89         __isl_take isl_pw_qpolynomial *pwqp2);
90 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
91         __isl_take isl_pw_qpolynomial *pwqp1,
92         __isl_take isl_pw_qpolynomial *pwqp2);
93 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
94         __isl_take isl_pw_qpolynomial *pwqp1,
95         __isl_take isl_pw_qpolynomial *pwqp2);
96 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
97         __isl_take isl_pw_qpolynomial *pwqp);
98 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
99         __isl_take isl_pw_qpolynomial *pwqp1,
100         __isl_take isl_pw_qpolynomial *pwqp2);
101
102 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_move(
103         __isl_take isl_pw_qpolynomial *pwqp,
104         enum isl_dim_type dst_type, unsigned dst_pos,
105         enum isl_dim_type src_type, unsigned src_pos, unsigned n);
106
107 __isl_give isl_qpolynomial *isl_pw_qpolynomial_eval(
108         __isl_take isl_pw_qpolynomial *pwqp, __isl_take isl_point *pnt);
109
110 __isl_give isl_qpolynomial *isl_pw_qpolynomial_max(
111         __isl_take isl_pw_qpolynomial *pwqp);
112
113 int isl_pw_qpolynomial_foreach_piece(__isl_keep isl_pw_qpolynomial *pwqp,
114         int (*fn)(__isl_take isl_set *set, __isl_take isl_qpolynomial *qp,
115                     void *user), void *user);
116 int isl_pw_qpolynomial_foreach_lifted_piece(__isl_keep isl_pw_qpolynomial *pwqp,
117         int (*fn)(__isl_take isl_set *set, __isl_take isl_qpolynomial *qp,
118                     void *user), void *user);
119
120 __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
121         __isl_take isl_printer *p, __isl_keep isl_pw_qpolynomial *pwqp);
122 void isl_pw_qpolynomial_print(__isl_keep isl_pw_qpolynomial *pwqp, FILE *out,
123         unsigned output_format);
124
125 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
126         __isl_take isl_pw_qpolynomial *pwqp, __isl_take isl_set *context);
127
128 enum isl_fold {
129         isl_fold_min,
130         isl_fold_max,
131         isl_fold_list
132 };
133
134 struct isl_qpolynomial_fold;
135 typedef struct isl_qpolynomial_fold isl_qpolynomial_fold;
136
137 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_empty(enum isl_fold type,
138         __isl_take isl_dim *dim);
139 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_alloc(
140         enum isl_fold type, __isl_take isl_qpolynomial *qp);
141 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_copy(
142         __isl_keep isl_qpolynomial_fold *fold);
143 void isl_qpolynomial_fold_free(__isl_take isl_qpolynomial_fold *fold);
144
145 int isl_qpolynomial_fold_is_empty(__isl_keep isl_qpolynomial_fold *fold);
146 int isl_qpolynomial_fold_is_equal(__isl_keep isl_qpolynomial_fold *fold1,
147         __isl_keep isl_qpolynomial_fold *fold2);
148
149 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_fold(
150         __isl_take isl_qpolynomial_fold *fold1,
151         __isl_take isl_qpolynomial_fold *fold2);
152
153 __isl_give isl_qpolynomial *isl_qpolynomial_fold_eval(
154         __isl_take isl_qpolynomial_fold *fold, __isl_take isl_point *pnt);
155
156 void isl_qpolynomial_fold_print(__isl_keep isl_qpolynomial_fold *fold, FILE *out,
157         unsigned output_format);
158
159 struct isl_pw_qpolynomial_fold;
160 typedef struct isl_pw_qpolynomial_fold isl_pw_qpolynomial_fold;
161
162 isl_ctx *isl_pw_qpolynomial_fold_get_ctx(__isl_keep isl_pw_qpolynomial_fold *pwf);
163
164 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_from_pw_qpolynomial(
165         enum isl_fold type, __isl_take isl_pw_qpolynomial *pwqp);
166
167 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_alloc(
168         __isl_take isl_set *set, __isl_take isl_qpolynomial_fold *fold);
169 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_copy(
170         __isl_keep isl_pw_qpolynomial_fold *pwf);
171 void isl_pw_qpolynomial_fold_free(__isl_take isl_pw_qpolynomial_fold *pwf);
172
173 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_zero(
174         __isl_take isl_dim *dim);
175
176 __isl_give isl_set *isl_pw_qpolynomial_fold_domain(
177         __isl_take isl_pw_qpolynomial_fold *pwf);
178 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_intersect_domain(
179         __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_set *set);
180
181 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
182         __isl_take isl_pw_qpolynomial_fold *pwf1,
183         __isl_take isl_pw_qpolynomial_fold *pwf2);
184 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add_disjoint(
185         __isl_take isl_pw_qpolynomial_fold *pwf1,
186         __isl_take isl_pw_qpolynomial_fold *pwf2);
187
188 __isl_give isl_qpolynomial *isl_pw_qpolynomial_fold_eval(
189         __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_point *pnt);
190
191 __isl_give isl_printer *isl_printer_print_pw_qpolynomial_fold(
192         __isl_take isl_printer *p, __isl_keep isl_pw_qpolynomial_fold *pwf);
193 void isl_pw_qpolynomial_fold_print(__isl_keep isl_pw_qpolynomial_fold *pwf,
194         FILE *out, unsigned output_format);
195
196 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_coalesce(
197         __isl_take isl_pw_qpolynomial_fold *pwf);
198 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_gist(
199         __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_set *context);
200
201 #if defined(__cplusplus)
202 }
203 #endif
204
205 #endif