From 8b5a230beac61fb0886a3d4fc6aff7b8e8887603 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sat, 18 Feb 2012 14:10:04 +0100 Subject: [PATCH] add isl_map_complement Signed-off-by: Sven Verdoolaege --- doc/user.pod | 2 ++ include/isl/map.h | 2 ++ isl_map_subtract.c | 15 ++++++++++----- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/doc/user.pod b/doc/user.pod index ddbdd56..1899300 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -1753,6 +1753,8 @@ i.e., whether both domain and range are nested relations. __isl_give isl_set *isl_set_complement( __isl_take isl_set *set); + __isl_give isl_map *isl_map_complement( + __isl_take isl_map *map); =item * Inverse map diff --git a/include/isl/map.h b/include/isl/map.h index 289e7cc..bc087e8 100644 --- a/include/isl/map.h +++ b/include/isl/map.h @@ -362,6 +362,8 @@ __isl_give isl_map *isl_map_subtract_domain(__isl_take isl_map *map, __isl_take isl_set *dom); __isl_give isl_map *isl_map_subtract_range(__isl_take isl_map *map, __isl_take isl_set *dom); +__isl_export +__isl_give isl_map *isl_map_complement(__isl_take isl_map *map); struct isl_map *isl_map_fix_input_si(struct isl_map *map, unsigned input, int value); __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map, diff --git a/isl_map_subtract.c b/isl_map_subtract.c index e34a369..d43cf3d 100644 --- a/isl_map_subtract.c +++ b/isl_map_subtract.c @@ -843,14 +843,19 @@ __isl_give isl_set *isl_set_make_disjoint(__isl_take isl_set *set) return (struct isl_set *)isl_map_make_disjoint((struct isl_map *)set); } -__isl_give isl_set *isl_set_complement(__isl_take isl_set *set) +__isl_give isl_map *isl_map_complement(__isl_take isl_map *map) { - isl_set *universe; + isl_map *universe; - if (!set) + if (!map) return NULL; - universe = isl_set_universe(isl_set_get_space(set)); + universe = isl_map_universe(isl_map_get_space(map)); + + return isl_map_subtract(universe, map); +} - return isl_set_subtract(universe, set); +__isl_give isl_set *isl_set_complement(__isl_take isl_set *set) +{ + return isl_map_complement(set); } -- 2.7.4