From b427884743e6b56167a738ad46b3f31261b136d2 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 18 Jun 2014 10:10:34 +0200 Subject: [PATCH] add isl_multi_union_pw_aff_domain Signed-off-by: Sven Verdoolaege --- doc/user.pod | 6 ++++++ include/isl/aff.h | 3 +++ isl_aff.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/doc/user.pod b/doc/user.pod index 54fd42fe..59987fd5 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -4058,9 +4058,15 @@ parameters. __isl_take isl_union_pw_aff *upa); __isl_give isl_union_set *isl_union_pw_multi_aff_domain( __isl_take isl_union_pw_multi_aff *upma); + __isl_give isl_union_set * + isl_multi_union_pw_aff_domain( + __isl_take isl_multi_union_pw_aff *mupa); __isl_give isl_set *isl_pw_aff_params( __isl_take isl_pw_aff *pwa); +The function C requires its +input to have at least one set dimension. + #include __isl_give isl_qpolynomial * isl_qpolynomial_project_domain_on_params( diff --git a/include/isl/aff.h b/include/isl/aff.h index 43606d6b..d4a7fc8a 100644 --- a/include/isl/aff.h +++ b/include/isl/aff.h @@ -831,6 +831,9 @@ __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_intersect_params( __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_intersect_range( __isl_take isl_multi_union_pw_aff *mupa, __isl_take isl_set *set); +__isl_give isl_union_set *isl_multi_union_pw_aff_domain( + __isl_take isl_multi_union_pw_aff *mupa); + __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_gist( __isl_take isl_multi_union_pw_aff *aff, __isl_take isl_union_set *context); diff --git a/isl_aff.c b/isl_aff.c index d8ac253a..dffdb649 100644 --- a/isl_aff.c +++ b/isl_aff.c @@ -8009,3 +8009,37 @@ error: isl_set_free(range); return NULL; } + +/* Return the shared domain of the elements of "mupa". + */ +__isl_give isl_union_set *isl_multi_union_pw_aff_domain( + __isl_take isl_multi_union_pw_aff *mupa) +{ + int i, n; + isl_union_pw_aff *upa; + isl_union_set *dom; + + if (!mupa) + return NULL; + + n = isl_multi_union_pw_aff_dim(mupa, isl_dim_set); + if (n == 0) + isl_die(isl_multi_union_pw_aff_get_ctx(mupa), isl_error_invalid, + "cannot determine domain", goto error); + + upa = isl_multi_union_pw_aff_get_union_pw_aff(mupa, 0); + dom = isl_union_pw_aff_domain(upa); + for (i = 1; i < n; ++i) { + isl_union_set *dom_i; + + upa = isl_multi_union_pw_aff_get_union_pw_aff(mupa, i); + dom_i = isl_union_pw_aff_domain(upa); + dom = isl_union_set_intersect(dom, dom_i); + } + + isl_multi_union_pw_aff_free(mupa); + return dom; +error: + isl_multi_union_pw_aff_free(mupa); + return NULL; +} -- 2.11.4.GIT