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