+#include <isl_ctx_private.h>
#include <isl/constraint.h>
#include <isl/set.h>
#include <isl_polynomial_private.h>
struct range_data data_m;
unsigned nvar;
unsigned nparam;
- isl_dim *dim;
+ isl_space *dim;
isl_qpolynomial *opt;
int r;
enum isl_fold type;
bset = isl_basic_set_move_dims(bset, isl_dim_set, 0,
isl_dim_param, 0, nparam);
- poly = isl_qpolynomial_move_dims(poly, isl_dim_set, 0,
+ poly = isl_qpolynomial_move_dims(poly, isl_dim_in, 0,
isl_dim_param, 0, nparam);
- dim = isl_qpolynomial_get_dim(poly);
- dim = isl_dim_drop(dim, isl_dim_set, 0, isl_dim_size(dim, isl_dim_set));
+ dim = isl_qpolynomial_get_space(poly);
+ dim = isl_space_params(dim);
+ dim = isl_space_from_domain(dim);
+ dim = isl_space_add_dims(dim, isl_dim_out, 1);
data_m.test_monotonicity = 0;
data_m.signs = signs;
__isl_keep isl_qpolynomial *poly, struct range_data *data)
{
isl_ctx *ctx;
- isl_dim *dim;
+ isl_space *dim;
isl_qpolynomial *sub = NULL;
isl_qpolynomial *diff = NULL;
int result = 0;
unsigned nvar;
ctx = isl_qpolynomial_get_ctx(poly);
- dim = isl_qpolynomial_get_dim(poly);
+ dim = isl_qpolynomial_get_domain_space(poly);
nvar = isl_basic_set_dim(bset, isl_dim_set);
- sub = isl_qpolynomial_var(isl_dim_copy(dim), isl_dim_set, nvar - 1);
+ sub = isl_qpolynomial_var_on_domain(isl_space_copy(dim), isl_dim_set, nvar - 1);
sub = isl_qpolynomial_add(sub,
- isl_qpolynomial_rat_cst(dim, ctx->one, ctx->one));
+ isl_qpolynomial_rat_cst_on_domain(dim, ctx->one, ctx->one));
diff = isl_qpolynomial_substitute(isl_qpolynomial_copy(poly),
- isl_dim_set, nvar - 1, 1, &sub);
+ isl_dim_in, nvar - 1, 1, &sub);
diff = isl_qpolynomial_sub(diff, isl_qpolynomial_copy(poly));
s = has_sign(bset, diff, 1, data->signs);
}
static __isl_give isl_qpolynomial *bound2poly(__isl_take isl_constraint *bound,
- __isl_take isl_dim *dim, unsigned pos, int sign)
+ __isl_take isl_space *dim, unsigned pos, int sign)
{
if (!bound) {
if (sign > 0)
- return isl_qpolynomial_infty(dim);
+ return isl_qpolynomial_infty_on_domain(dim);
else
- return isl_qpolynomial_neginfty(dim);
+ return isl_qpolynomial_neginfty_on_domain(dim);
}
- isl_dim_free(dim);
+ isl_space_free(dim);
return isl_qpolynomial_from_constraint(bound, isl_dim_set, pos);
}
__isl_give isl_qpolynomial *isl_qpolynomial_terms_of_sign(
__isl_keep isl_qpolynomial *poly, int *signs, int sign)
{
+ isl_space *space;
struct isl_fixed_sign_data data = { signs, sign };
- data.poly = isl_qpolynomial_zero(isl_qpolynomial_get_dim(poly));
+
+ space = isl_qpolynomial_get_domain_space(poly);
+ data.poly = isl_qpolynomial_zero_on_domain(space);
if (isl_qpolynomial_foreach_term(poly, collect_fixed_sign_terms, &data) < 0)
goto error;
isl_qpolynomial_fold *fold;
isl_pw_qpolynomial_fold *pwf;
+ bset = isl_basic_set_params(bset);
+ poly = isl_qpolynomial_project_domain_on_params(poly);
+
fold = isl_qpolynomial_fold_alloc(type, poly);
set = isl_set_from_basic_set(bset);
pwf = isl_pw_qpolynomial_fold_alloc(type, set, fold);
if (data->monotonicity) {
isl_qpolynomial *sub;
- isl_dim *dim = isl_qpolynomial_get_dim(data->poly);
+ isl_space *dim = isl_qpolynomial_get_domain_space(data->poly);
if (data->monotonicity * data->sign > 0) {
if (data->tight)
data->tight = bound_is_integer(upper, nvar);
isl_constraint_free(upper);
}
poly = isl_qpolynomial_copy(data->poly);
- poly = isl_qpolynomial_substitute(poly, isl_dim_set, nvar, 1, &sub);
- poly = isl_qpolynomial_drop_dims(poly, isl_dim_set, nvar, 1);
+ poly = isl_qpolynomial_substitute(poly, isl_dim_in, nvar, 1, &sub);
+ poly = isl_qpolynomial_drop_dims(poly, isl_dim_in, nvar, 1);
isl_qpolynomial_free(sub);
} else {
isl_qpolynomial *l, *u;
isl_qpolynomial *pos, *neg;
- isl_dim *dim = isl_qpolynomial_get_dim(data->poly);
+ isl_space *dim = isl_qpolynomial_get_domain_space(data->poly);
unsigned nparam = isl_basic_set_dim(bset, isl_dim_param);
int sign = data->sign * data->signs[nparam + nvar];
data->tight = 0;
- u = bound2poly(upper, isl_dim_copy(dim), nvar, 1);
+ u = bound2poly(upper, isl_space_copy(dim), nvar, 1);
l = bound2poly(lower, dim, nvar, -1);
pos = isl_qpolynomial_terms_of_sign(data->poly, data->signs, sign);
neg = isl_qpolynomial_terms_of_sign(data->poly, data->signs, -sign);
- pos = isl_qpolynomial_substitute(pos, isl_dim_set, nvar, 1, &u);
- neg = isl_qpolynomial_substitute(neg, isl_dim_set, nvar, 1, &l);
+ pos = isl_qpolynomial_substitute(pos, isl_dim_in, nvar, 1, &u);
+ neg = isl_qpolynomial_substitute(neg, isl_dim_in, nvar, 1, &l);
poly = isl_qpolynomial_add(pos, neg);
- poly = isl_qpolynomial_drop_dims(poly, isl_dim_set, nvar, 1);
+ poly = isl_qpolynomial_drop_dims(poly, isl_dim_in, nvar, 1);
isl_qpolynomial_free(u);
isl_qpolynomial_free(l);
static int propagate_on_domain(__isl_take isl_basic_set *bset,
__isl_take isl_qpolynomial *poly, struct range_data *data)
{
+ isl_ctx *ctx;
isl_qpolynomial *save_poly = data->poly;
int save_monotonicity = data->monotonicity;
unsigned d;
if (!bset || !poly)
goto error;
+ ctx = isl_basic_set_get_ctx(bset);
d = isl_basic_set_dim(bset, isl_dim_set);
- isl_assert(bset->ctx, d >= 1, goto error);
+ isl_assert(ctx, d >= 1, goto error);
if (isl_qpolynomial_is_cst(poly, NULL, NULL)) {
bset = isl_basic_set_project_out(bset, isl_dim_set, 0, d);
- poly = isl_qpolynomial_drop_dims(poly, isl_dim_set, 0, d);
+ poly = isl_qpolynomial_drop_dims(poly, isl_dim_in, 0, d);
return add_guarded_poly(bset, poly, data);
}
static int basic_guarded_poly_bound(__isl_take isl_basic_set *bset, void *user)
{
struct range_data *data = (struct range_data *)user;
+ isl_ctx *ctx;
unsigned nparam = isl_basic_set_dim(bset, isl_dim_param);
unsigned dim = isl_basic_set_dim(bset, isl_dim_set);
int r;
data->signs = NULL;
- data->signs = isl_alloc_array(bset->ctx, int,
+ ctx = isl_basic_set_get_ctx(bset);
+ data->signs = isl_alloc_array(ctx, int,
isl_basic_set_dim(bset, isl_dim_all));
if (isl_basic_set_dims_get_sign(bset, isl_dim_set, 0, dim,