summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Verdoolaege <skimo@kotnet.org>2011-12-06 09:17:03 +0100
committerSven Verdoolaege <skimo@kotnet.org>2011-12-10 19:41:48 +0100
commitffbcd033895737a4068d2a4376aff3d0da434eef (patch)
tree379e81bc892c7bf663223cd24b75434bc624e91b
parent0a2810732967eee50d8c55a371a28704d8a1ec17 (diff)
downloadisl-ffbcd033895737a4068d2a4376aff3d0da434eef.tar.gz
isl-ffbcd033895737a4068d2a4376aff3d0da434eef.tar.bz2
isl-ffbcd033895737a4068d2a4376aff3d0da434eef.zip
add isl_space_map_from_domain_and_range
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
-rw-r--r--doc/user.pod3
-rw-r--r--include/isl/space.h2
-rw-r--r--isl_space.c18
3 files changed, 23 insertions, 0 deletions
diff --git a/doc/user.pod b/doc/user.pod
index a1f7fb55..6c40d9ea 100644
--- a/doc/user.pod
+++ b/doc/user.pod
@@ -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
diff --git a/include/isl/space.h b/include/isl/space.h
index d3496e0b..afbd3e37 100644
--- a/include/isl/space.h
+++ b/include/isl/space.h
@@ -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);
diff --git a/isl_space.c b/isl_space.c
index ae68013b..88b96268 100644
--- a/isl_space.c
+++ b/isl_space.c
@@ -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)