add isl_union_map_uncurry
authorSven Verdoolaege <skimo@kotnet.org>
Fri, 23 Nov 2012 14:41:24 +0000 (15:41 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Sat, 24 Nov 2012 09:29:03 +0000 (10:29 +0100)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
doc/user.pod
include/isl/union_map.h
isl_union_map.c

index abf4031..950f93c 100644 (file)
@@ -2565,6 +2565,8 @@ interchange the range of the domain with the domain of the range.
                __isl_take isl_map *map);
        __isl_give isl_union_map *isl_union_map_curry(
                __isl_take isl_union_map *umap);
+       __isl_give isl_union_map *isl_union_map_uncurry(
+               __isl_take isl_union_map *umap);
 
 Given a relation with a nested relation for domain,
 the C<curry> functions
index 0992b4c..8eb7b2f 100644 (file)
@@ -186,6 +186,7 @@ __isl_give isl_union_map *isl_union_set_unwrap(__isl_take isl_union_set *uset);
 
 __isl_give isl_union_map *isl_union_map_zip(__isl_take isl_union_map *umap);
 __isl_give isl_union_map *isl_union_map_curry(__isl_take isl_union_map *umap);
+__isl_give isl_union_map *isl_union_map_uncurry(__isl_take isl_union_map *umap);
 
 __isl_give isl_union_map *isl_union_map_align_params(
        __isl_take isl_union_map *umap, __isl_take isl_space *model);
index bb82de7..1528ebd 100644 (file)
@@ -2394,6 +2394,27 @@ __isl_give isl_union_map *isl_union_map_zip(__isl_take isl_union_map *umap)
        return cond_un_op(umap, &zip_entry);
 }
 
+static int uncurry_entry(void **entry, void *user)
+{
+       isl_map *map = *entry;
+       isl_union_map **res = user;
+
+       if (!isl_map_can_uncurry(map))
+               return 0;
+
+       *res = isl_union_map_add_map(*res, isl_map_uncurry(isl_map_copy(map)));
+
+       return 0;
+}
+
+/* Given a union map, take the maps of the form A -> (B -> C) and
+ * return the union of the corresponding maps (A -> B) -> C.
+ */
+__isl_give isl_union_map *isl_union_map_uncurry(__isl_take isl_union_map *umap)
+{
+       return cond_un_op(umap, &uncurry_entry);
+}
+
 static int curry_entry(void **entry, void *user)
 {
        isl_map *map = *entry;