summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Verdoolaege <skimo@kotnet.org>2012-08-07 16:46:55 +0200
committerSven Verdoolaege <skimo@kotnet.org>2012-08-07 16:53:39 +0200
commitbe9c5c5145280761e94220db269f509837b8120e (patch)
tree2eece8bf7a9769e4c3eaa408db6a6aec0dcabf1e
parent6e19f41057afd266f6e3fafcf7651f82ee23fbae (diff)
downloadisl-be9c5c5145280761e94220db269f509837b8120e.tar.gz
isl-be9c5c5145280761e94220db269f509837b8120e.tar.bz2
isl-be9c5c5145280761e94220db269f509837b8120e.zip
export isl_space_is_domain
We cannot simply export the private isl_space_is_domain however, since that one is also used in cases where the first argument is a parameter space and the second argument is a set space. Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
-rw-r--r--doc/user.pod9
-rw-r--r--include/isl/space.h2
-rw-r--r--isl_pw_templ.c5
-rw-r--r--isl_space.c17
-rw-r--r--isl_space_private.h2
5 files changed, 30 insertions, 5 deletions
diff --git a/doc/user.pod b/doc/user.pod
index af31a033..159dba36 100644
--- a/doc/user.pod
+++ b/doc/user.pod
@@ -616,11 +616,18 @@ or whether it is a parameter space, use these functions:
int isl_space_is_set(__isl_keep isl_space *space);
int isl_space_is_map(__isl_keep isl_space *space);
-Spaces can be compared using the following function:
+Spaces can be compared using the following functions:
#include <isl/space.h>
int isl_space_is_equal(__isl_keep isl_space *space1,
__isl_keep isl_space *space2);
+ int isl_space_is_domain(__isl_keep isl_space *space1,
+ __isl_keep isl_space *space2);
+
+C<isl_space_is_domain> checks whether the first argument is equal
+to the domain of the second argument. This requires in particular that
+the first argument is a set space and that the second argument
+is a map space.
It is often useful to create objects that live in the
same space as some other object. This can be accomplished
diff --git a/include/isl/space.h b/include/isl/space.h
index e3d7e043..ec552c4b 100644
--- a/include/isl/space.h
+++ b/include/isl/space.h
@@ -125,6 +125,8 @@ __isl_give isl_space *isl_space_zip(__isl_take isl_space *dim);
int isl_space_can_curry(__isl_keep isl_space *space);
__isl_give isl_space *isl_space_curry(__isl_take isl_space *space);
+int isl_space_is_domain(__isl_keep isl_space *space1,
+ __isl_keep isl_space *space2);
int isl_space_is_equal(__isl_keep isl_space *space1,
__isl_keep isl_space *space2);
int isl_space_match(__isl_keep isl_space *dim1, enum isl_dim_type dim1_type,
diff --git a/isl_pw_templ.c b/isl_pw_templ.c
index ec8f12e2..b80e084f 100644
--- a/isl_pw_templ.c
+++ b/isl_pw_templ.c
@@ -648,7 +648,8 @@ __isl_give isl_qpolynomial *FN(PW,eval)(__isl_take PW *pw,
goto error;
ctx = isl_point_get_ctx(pnt);
pnt_dim = isl_point_get_space(pnt);
- isl_assert(ctx, isl_space_is_domain(pnt_dim, pw->dim), goto error);
+ isl_assert(ctx, isl_space_is_domain_internal(pnt_dim, pw->dim),
+ goto error);
for (i = 0; i < pw->n; ++i) {
found = isl_set_contains_point(pw->p[i].set, pnt);
@@ -1307,7 +1308,7 @@ __isl_give PW *FN(PW,morph_domain)(__isl_take PW *pw,
goto error;
ctx = isl_space_get_ctx(pw->dim);
- isl_assert(ctx, isl_space_is_domain(morph->dom->dim, pw->dim),
+ isl_assert(ctx, isl_space_is_domain_internal(morph->dom->dim, pw->dim),
goto error);
pw = FN(PW,cow)(pw);
diff --git a/isl_space.c b/isl_space.c
index 3ec09d29..e54fbde1 100644
--- a/isl_space.c
+++ b/isl_space.c
@@ -1473,8 +1473,11 @@ int isl_space_is_equal(__isl_keep isl_space *dim1, __isl_keep isl_space *dim2)
}
/* Is space1 equal to the domain of space2?
+ *
+ * In the internal version we also allow space2 to be the space of a set,
+ * provided space1 is a parameter space.
*/
-int isl_space_is_domain(__isl_keep isl_space *space1,
+int isl_space_is_domain_internal(__isl_keep isl_space *space1,
__isl_keep isl_space *space2)
{
if (!space1 || !space2)
@@ -1485,6 +1488,18 @@ int isl_space_is_domain(__isl_keep isl_space *space1,
isl_space_tuple_match(space1, isl_dim_set, space2, isl_dim_in);
}
+/* Is space1 equal to the domain of space2?
+ */
+int isl_space_is_domain(__isl_keep isl_space *space1,
+ __isl_keep isl_space *space2)
+{
+ if (!space2)
+ return -1;
+ if (!isl_space_is_map(space2))
+ return 0;
+ return isl_space_is_domain_internal(space1, space2);
+}
+
int isl_space_compatible(__isl_keep isl_space *dim1,
__isl_keep isl_space *dim2)
{
diff --git a/isl_space_private.h b/isl_space_private.h
index 73762de4..031a3322 100644
--- a/isl_space_private.h
+++ b/isl_space_private.h
@@ -26,7 +26,7 @@ __isl_give isl_space *isl_space_underlying(__isl_take isl_space *dim,
uint32_t isl_space_get_hash(__isl_keep isl_space *dim);
-int isl_space_is_domain(__isl_keep isl_space *space1,
+int isl_space_is_domain_internal(__isl_keep isl_space *space1,
__isl_keep isl_space *space2);
__isl_give isl_space *isl_space_as_set_space(__isl_take isl_space *dim);