add isl_space_map_from_domain_and_range
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 6 Dec 2011 08:17:03 +0000 (09:17 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Sat, 10 Dec 2011 18:41:48 +0000 (19:41 +0100)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
doc/user.pod
include/isl/space.h
isl_space.c

index a1f7fb5..6c40d9e 100644 (file)
@@ -764,6 +764,9 @@ using the following functions.
                unsigned n);
        __isl_give isl_space *isl_space_map_from_set(
                __isl_take isl_space *space);
+       __isl_give isl_space *isl_space_map_from_domain_and_range(
+               __isl_take isl_space *domain,
+               __isl_take isl_space *range);
        __isl_give isl_space *isl_space_zip(__isl_take isl_space *space);
 
 Note that if dimensions are added or removed from a space, then
index d3496e0..afbd3e3 100644 (file)
@@ -91,6 +91,8 @@ __isl_give isl_space *isl_space_domain_product(__isl_take isl_space *left,
 __isl_give isl_space *isl_space_range_product(__isl_take isl_space *left,
        __isl_take isl_space *right);
 __isl_give isl_space *isl_space_map_from_set(__isl_take isl_space *dim);
+__isl_give isl_space *isl_space_map_from_domain_and_range(
+       __isl_take isl_space *domain, __isl_take isl_space *range);
 __isl_give isl_space *isl_space_reverse(__isl_take isl_space *dim);
 __isl_give isl_space *isl_space_drop_dims(__isl_take isl_space *dim,
        enum isl_dim_type type, unsigned first, unsigned num);
index ae68013..88b9626 100644 (file)
@@ -1067,6 +1067,24 @@ error:
        return NULL;
 }
 
+__isl_give isl_space *isl_space_map_from_domain_and_range(
+       __isl_take isl_space *domain, __isl_take isl_space *range)
+{
+       if (!domain || !range)
+               goto error;
+       if (!isl_space_is_set(domain))
+               isl_die(isl_space_get_ctx(domain), isl_error_invalid,
+                       "domain is not a set space", goto error);
+       if (!isl_space_is_set(range))
+               isl_die(isl_space_get_ctx(range), isl_error_invalid,
+                       "range is not a set space", goto error);
+       return isl_space_join(isl_space_reverse(domain), range);
+error:
+       isl_space_free(domain);
+       isl_space_free(range);
+       return NULL;
+}
+
 static __isl_give isl_space *set_ids(__isl_take isl_space *dim,
        enum isl_dim_type type,
        unsigned first, unsigned n, __isl_take isl_id **ids)