From 2b37b4aa395a360f691bb07751123dcd4388a1c6 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 22 Dec 2008 15:00:07 +0100 Subject: [PATCH] avoid increasing "extra" without also extending the div array The "extra" variable is used to indicate both the number of extra variables in the columns beyond those in dim and the number of rows in the div array. We can therefore not increase extra, without also extending this array. --- isl_map.c | 16 ++++++++++++++-- isl_mat.c | 11 ++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/isl_map.c b/isl_map.c index 07064a1..5ef0d1b 100644 --- a/isl_map.c +++ b/isl_map.c @@ -938,6 +938,13 @@ static void constraint_drop_vars(isl_int *c, unsigned n, unsigned rem) isl_seq_clr(c + rem, n); } +/* Drop n dimensions starting at first. + * + * In principle, this frees up some extra variables as the number + * of columns remains constant, but we would have to extend + * the div array too as the number of rows in this array is assumed + * to be equal to extra. + */ struct isl_basic_set *isl_basic_set_drop_dims( struct isl_basic_set *bset, unsigned first, unsigned n) { @@ -970,7 +977,6 @@ struct isl_basic_set *isl_basic_set_drop_dims( bset->dim = isl_dim_drop_outputs(bset->dim, first, n); if (!bset->dim) goto error; - bset->extra += n; F_CLR(bset, ISL_BASIC_SET_NORMALIZED); bset = isl_basic_set_simplify(bset); @@ -1012,6 +1018,13 @@ error: return NULL; } +/* Drop n input dimensions starting at first. + * + * In principle, this frees up some extra variables as the number + * of columns remains constant, but we would have to extend + * the div array too as the number of rows in this array is assumed + * to be equal to extra. + */ struct isl_basic_map *isl_basic_map_drop_inputs( struct isl_basic_map *bmap, unsigned first, unsigned n) { @@ -1050,7 +1063,6 @@ struct isl_basic_map *isl_basic_map_drop_inputs( bmap->dim = isl_dim_drop_inputs(bmap->dim, first, n); if (!bmap->dim) goto error; - bmap->extra += n; F_CLR(bmap, ISL_BASIC_MAP_NORMALIZED); bmap = isl_basic_map_simplify(bmap); diff --git a/isl_mat.c b/isl_mat.c index e663838..3fde011 100644 --- a/isl_mat.c +++ b/isl_mat.c @@ -675,6 +675,16 @@ error: return NULL; } +/* Replace the variables x in bset by x' given by x = M x', with + * M the matrix mat. + * + * If there are fewer variables x' then there are x, then we perform + * the transformation in place, which that, in principle, + * this frees up some extra variables as the number + * of columns remains constant, but we would have to extend + * the div array too as the number of rows in this array is assumed + * to be equal to extra. + */ struct isl_basic_set *isl_basic_set_preimage(struct isl_ctx *ctx, struct isl_basic_set *bset, struct isl_mat *mat) { @@ -700,7 +710,6 @@ struct isl_basic_set *isl_basic_set_preimage(struct isl_ctx *ctx, if (!bset->dim) goto error; bset->dim->n_out -= mat->n_row - mat->n_col; - bset->extra += mat->n_row - mat->n_col; } t = isl_mat_sub_alloc(ctx, bset->eq, 0, bset->n_eq, 0, mat->n_row); -- 2.7.4