isl_convex_hull.c: valid_direction: properly normalize valid direction
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 23 Mar 2010 23:07:14 +0000 (00:07 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 23 Mar 2010 23:07:14 +0000 (00:07 +0100)
The original code would only normalize all but one of the coordinates
of the valid direction, possibly resulting in a scaled direction, which
may no longer be valid.  Normalize the whole vector, resulting in only
a change of representation and not a change of direction.

isl_convex_hull.c

index 58c8014..0a2046d 100644 (file)
@@ -1086,7 +1086,7 @@ error:
  * (including the "positivity constraint" 1 >= 0) and \alpha_{ij}
  * strictly positive numbers.  For simplicity we impose \alpha_{ij} >= 1.
  * We first set up an LP with as variables the \alpha{ij}.
- * In this formulateion, for each polyhedron i,
+ * In this formulation, for each polyhedron i,
  * the first constraint is the positivity constraint, followed by pairs
  * of variables for the equalities, followed by variables for the inequalities.
  * We then simply pick a feasible solution and compute s using (*).
@@ -1137,7 +1137,7 @@ static struct isl_vec *valid_direction(
                                bset1->ctx->one, dir->block.data,
                                sample->block.data[n++], bset1->ineq[i], 1 + d);
        isl_vec_free(sample);
-       isl_seq_normalize(bset1->ctx, dir->block.data + 1, dir->size - 1);
+       isl_seq_normalize(bset1->ctx, dir->el, dir->size);
        isl_basic_set_free(bset1);
        isl_basic_set_free(bset2);
        return dir;