From: Sven Verdoolaege Date: Thu, 28 Mar 2013 13:06:25 +0000 (+0100) Subject: add isl_set_{lexmin,lexmax}_pw_multi_aff X-Git-Tag: isl-0.12~166 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be44215f009bcd823d9372c13e224b1746b2d793;p=platform%2Fupstream%2Fisl.git add isl_set_{lexmin,lexmax}_pw_multi_aff Signed-off-by: Sven Verdoolaege --- diff --git a/doc/user.pod b/doc/user.pod index 373c536..a33887c 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -3066,6 +3066,10 @@ returning a basic set or relation. __isl_take isl_basic_map *bmap, __isl_take isl_basic_set *dom, __isl_give isl_set **empty); + __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff( + __isl_take isl_set *set); + __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff( + __isl_take isl_set *set); __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff( __isl_take isl_map *map); __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff( diff --git a/include/isl/set.h b/include/isl/set.h index 3f65fea..863f5ce 100644 --- a/include/isl/set.h +++ b/include/isl/set.h @@ -212,6 +212,10 @@ __isl_give isl_pw_multi_aff *isl_basic_set_partial_lexmin_pw_multi_aff( __isl_give isl_pw_multi_aff *isl_basic_set_partial_lexmax_pw_multi_aff( __isl_take isl_basic_set *bset, __isl_take isl_basic_set *dom, __isl_give isl_set **empty); +__isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff( + __isl_take isl_set *set); +__isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff( + __isl_take isl_set *set); __isl_export __isl_give isl_set *isl_basic_set_union( diff --git a/isl_map.c b/isl_map.c index 6fffa60..c011a94 100644 --- a/isl_map.c +++ b/isl_map.c @@ -6111,16 +6111,6 @@ __isl_give isl_set *isl_basic_set_lexmax(__isl_take isl_basic_set *bset) return (isl_set *)isl_basic_map_lexmax((isl_basic_map *)bset); } -__isl_give isl_set *isl_set_lexmin(__isl_take isl_set *set) -{ - return (isl_set *)isl_map_lexmin((isl_map *)set); -} - -__isl_give isl_set *isl_set_lexmax(__isl_take isl_set *set) -{ - return (isl_set *)isl_map_lexmax((isl_map *)set); -} - /* Extract the first and only affine expression from list * and then add it to *pwaff with the given dom. * This domain is known to be disjoint from other domains diff --git a/isl_map_lexopt_templ.c b/isl_map_lexopt_templ.c index 0c41702..1196a87 100644 --- a/isl_map_lexopt_templ.c +++ b/isl_map_lexopt_templ.c @@ -130,3 +130,13 @@ __isl_give TYPE *SF(isl_map_lexmax,SUFFIX)(__isl_take isl_map *map) { return SF(isl_map_lexopt,SUFFIX)(map, 1); } + +__isl_give TYPE *SF(isl_set_lexmin,SUFFIX)(__isl_take isl_set *set) +{ + return SF(isl_map_lexmin,SUFFIX)(set); +} + +__isl_give TYPE *SF(isl_set_lexmax,SUFFIX)(__isl_take isl_set *set) +{ + return SF(isl_map_lexmax,SUFFIX)(set); +} diff --git a/isl_test.c b/isl_test.c index d2ba6eb..dda64e3 100644 --- a/isl_test.c +++ b/isl_test.c @@ -1454,8 +1454,9 @@ void test_lex(struct isl_ctx *ctx) isl_map_free(map); } -void test_lexmin(struct isl_ctx *ctx) +static int test_lexmin(struct isl_ctx *ctx) { + int equal; const char *str; isl_basic_map *bmap; isl_map *map, *map2; @@ -1537,6 +1538,23 @@ void test_lexmin(struct isl_ctx *ctx) assert(isl_map_is_equal(map, map2)); isl_map_free(map); isl_map_free(map2); + + str = "[i] -> { [i', j] : j = i - 8i' and i' >= 0 and i' <= 7 and " + " 8i' <= i and 8i' >= -7 + i }"; + set = isl_set_read_from_str(ctx, str); + pma = isl_set_lexmin_pw_multi_aff(isl_set_copy(set)); + set2 = isl_set_from_pw_multi_aff(pma); + equal = isl_set_is_equal(set, set2); + isl_set_free(set); + isl_set_free(set2); + if (equal < 0) + return -1; + if (!equal) + isl_die(ctx, isl_error_unknown, + "unexpected difference between set and " + "piecewise affine expression", return -1); + + return 0; } struct must_may { @@ -3957,6 +3975,7 @@ struct { { "factorize", &test_factorize }, { "subset", &test_subset }, { "subtract", &test_subtract }, + { "lexmin", &test_lexmin }, }; int main() @@ -3989,7 +4008,6 @@ int main() test_convex_hull(ctx); test_gist(ctx); test_closure(ctx); - test_lexmin(ctx); isl_ctx_free(ctx); return 0; error: