avoid increasing "extra" without also extending the div array
authorSven Verdoolaege <skimo@kotnet.org>
Mon, 22 Dec 2008 14:00:07 +0000 (15:00 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Mon, 22 Dec 2008 14:00:07 +0000 (15:00 +0100)
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
isl_mat.c

index 07064a1..5ef0d1b 100644 (file)
--- 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);
index e663838..3fde011 100644 (file)
--- 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);