From 482d4d88ef10cfd9b4c541a247746625681135f8 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 22 Oct 2008 13:03:14 +0200 Subject: [PATCH] add isl_set_dim_is_unique --- include/isl_set.h | 2 ++ isl_map.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/include/isl_set.h b/include/isl_set.h index 3f9e655..0bc5eb6 100644 --- a/include/isl_set.h +++ b/include/isl_set.h @@ -184,6 +184,8 @@ int isl_set_fast_is_disjoint(struct isl_set *set1, struct isl_set *set2); uint32_t isl_set_get_hash(struct isl_set *set); +int isl_set_dim_is_unique(struct isl_set *set, unsigned dim); + #if defined(__cplusplus) } #endif diff --git a/isl_map.c b/isl_map.c index 1cdc92f..ab147b8 100644 --- a/isl_map.c +++ b/isl_map.c @@ -4821,3 +4821,39 @@ uint32_t isl_set_get_hash(struct isl_set *set) return hash; } + +/* Check if the value for dimension dim is completely determined + * by the values of the other parameters and variables. + * That is, check if dimension dim is involved in an equality. + */ +int isl_basic_set_dim_is_unique(struct isl_basic_set *bset, unsigned dim) +{ + int i; + + if (!bset) + return -1; + for (i = 0; i < bset->n_eq; ++i) + if (!isl_int_is_zero(bset->eq[i][1 + bset->nparam + dim])) + return 1; + return 0; +} + +/* Check if the value for dimension dim is completely determined + * by the values of the other parameters and variables. + * That is, check if dimension dim is involved in an equality + * for each of the subsets. + */ +int isl_set_dim_is_unique(struct isl_set *set, unsigned dim) +{ + int i; + + if (!set) + return -1; + for (i = 0; i < set->n; ++i) { + int unique; + unique = isl_basic_set_dim_is_unique(set->p[i], dim); + if (unique != 1) + return unique; + } + return 1; +} -- 2.7.4