From 7fa6772d24396da1083a1080501341aa1aedcc62 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 3 Mar 2010 16:23:21 +0100 Subject: [PATCH] isl_set_wrap_facet: make sure set is marked rational When isl_set_wrap_facet is used from with isl_convex_hull.c, then the set should already have been marked rational, but when called from outside, it may not, so we have to do it explicitly. --- isl_convex_hull.c | 1 + isl_test.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/isl_convex_hull.c b/isl_convex_hull.c index 41427f19..31b575b8 100644 --- a/isl_convex_hull.c +++ b/isl_convex_hull.c @@ -473,6 +473,7 @@ isl_int *isl_set_wrap_facet(__isl_keep isl_set *set, unsigned dim; set = isl_set_copy(set); + set = isl_set_set_rational(set); dim = 1 + isl_set_n_dim(set); T = isl_mat_alloc(set->ctx, 3, dim); diff --git a/isl_test.c b/isl_test.c index 127e664d..37930ec5 100644 --- a/isl_test.c +++ b/isl_test.c @@ -529,6 +529,7 @@ void test_gist(struct isl_ctx *ctx) void test_coalesce(struct isl_ctx *ctx) { struct isl_set *set, *set2; + struct isl_map *map, *map2; set = isl_set_read_from_str(ctx, "{[x,y]: x >= 0 & x <= 10 & y >= 0 & y <= 10 or " @@ -635,6 +636,49 @@ void test_coalesce(struct isl_ctx *ctx) assert(isl_set_is_equal(set, set2)); isl_set_free(set); isl_set_free(set2); + + map = isl_map_read_from_str(ctx, + "[n] -> { [i0] -> [o0] : exists (e0 = [(i0)/4], e1 = [(o0)/4], " + "e2 = [(n)/2], e3 = [(-2 + i0)/4], e4 = [(-2 + o0)/4], " + "e5 = [(-2n + i0)/4]: 2e2 = n and 4e3 = -2 + i0 and " + "4e4 = -2 + o0 and i0 >= 8 + 2n and o0 >= 2 + i0 and " + "o0 <= 56 + 2n and o0 <= -12 + 4n and i0 <= 57 + 2n and " + "i0 <= -11 + 4n and o0 >= 6 + 2n and 4e0 <= i0 and " + "4e0 >= -3 + i0 and 4e1 <= o0 and 4e1 >= -3 + o0 and " + "4e5 <= -2n + i0 and 4e5 >= -3 - 2n + i0);" + "[i0] -> [o0] : exists (e0 = [(i0)/4], e1 = [(o0)/4], " + "e2 = [(n)/2], e3 = [(-2 + i0)/4], e4 = [(-2 + o0)/4], " + "e5 = [(-2n + i0)/4]: 2e2 = n and 4e3 = -2 + i0 and " + "4e4 = -2 + o0 and 2e0 >= 3 + n and e0 <= -4 + n and " + "2e0 <= 27 + n and e1 <= -4 + n and 2e1 <= 27 + n and " + "2e1 >= 2 + n and e1 >= 1 + e0 and i0 >= 7 + 2n and " + "i0 <= -11 + 4n and i0 <= 57 + 2n and 4e0 <= -2 + i0 and " + "4e0 >= -3 + i0 and o0 >= 6 + 2n and o0 <= -11 + 4n and " + "o0 <= 57 + 2n and 4e1 <= -2 + o0 and 4e1 >= -3 + o0 and " + "4e5 <= -2n + i0 and 4e5 >= -3 - 2n + i0 ) }", -1); + map = isl_map_coalesce(map); + map2 = isl_map_read_from_str(ctx, + "[n] -> { [i0] -> [o0] : exists (e0 = [(i0)/4], e1 = [(o0)/4], " + "e2 = [(n)/2], e3 = [(-2 + i0)/4], e4 = [(-2 + o0)/4], " + "e5 = [(-2n + i0)/4]: 2e2 = n and 4e3 = -2 + i0 and " + "4e4 = -2 + o0 and i0 >= 8 + 2n and o0 >= 2 + i0 and " + "o0 <= 56 + 2n and o0 <= -12 + 4n and i0 <= 57 + 2n and " + "i0 <= -11 + 4n and o0 >= 6 + 2n and 4e0 <= i0 and " + "4e0 >= -3 + i0 and 4e1 <= o0 and 4e1 >= -3 + o0 and " + "4e5 <= -2n + i0 and 4e5 >= -3 - 2n + i0);" + "[i0] -> [o0] : exists (e0 = [(i0)/4], e1 = [(o0)/4], " + "e2 = [(n)/2], e3 = [(-2 + i0)/4], e4 = [(-2 + o0)/4], " + "e5 = [(-2n + i0)/4]: 2e2 = n and 4e3 = -2 + i0 and " + "4e4 = -2 + o0 and 2e0 >= 3 + n and e0 <= -4 + n and " + "2e0 <= 27 + n and e1 <= -4 + n and 2e1 <= 27 + n and " + "2e1 >= 2 + n and e1 >= 1 + e0 and i0 >= 7 + 2n and " + "i0 <= -11 + 4n and i0 <= 57 + 2n and 4e0 <= -2 + i0 and " + "4e0 >= -3 + i0 and o0 >= 6 + 2n and o0 <= -11 + 4n and " + "o0 <= 57 + 2n and 4e1 <= -2 + o0 and 4e1 >= -3 + o0 and " + "4e5 <= -2n + i0 and 4e5 >= -3 - 2n + i0 ) }", -1); + assert(isl_map_is_equal(map, map2)); + isl_map_free(map); + isl_map_free(map2); } void test_closure(struct isl_ctx *ctx) -- 2.11.4.GIT