From 6e292a5327beef7aa91a83f7acd0eba2e5053405 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 24 Mar 2010 00:07:14 +0100 Subject: [PATCH] isl_convex_hull.c: valid_direction: properly normalize valid direction 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/isl_convex_hull.c b/isl_convex_hull.c index 58c8014..0a2046d 100644 --- a/isl_convex_hull.c +++ b/isl_convex_hull.c @@ -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; -- 2.7.4