add isl_morph_{dom,ran}_params
authorSven Verdoolaege <skimo@kotnet.org>
Sat, 27 Aug 2011 08:43:29 +0000 (10:43 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Sat, 3 Sep 2011 10:04:55 +0000 (12:04 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_morph.c
isl_morph.h

index af96805..69aabab 100644 (file)
@@ -166,6 +166,46 @@ __isl_give isl_morph *isl_morph_remove_ran_dims(__isl_take isl_morph *morph,
        return NULL;
 }
 
+/* Project domain of morph onto its parameter domain.
+ */
+__isl_give isl_morph *isl_morph_dom_params(__isl_take isl_morph *morph)
+{
+       unsigned n;
+
+       if (!morph)
+               return NULL;
+       n = isl_basic_set_dim(morph->dom, isl_dim_set);
+       morph = isl_morph_remove_dom_dims(morph, isl_dim_set, 0, n);
+       if (!morph)
+               return NULL;
+       morph->dom = isl_basic_set_params(morph->dom);
+       if (morph->dom)
+               return morph;
+
+       isl_morph_free(morph);
+       return NULL;
+}
+
+/* Project range of morph onto its parameter domain.
+ */
+__isl_give isl_morph *isl_morph_ran_params(__isl_take isl_morph *morph)
+{
+       unsigned n;
+
+       if (!morph)
+               return NULL;
+       n = isl_basic_set_dim(morph->ran, isl_dim_set);
+       morph = isl_morph_remove_ran_dims(morph, isl_dim_set, 0, n);
+       if (!morph)
+               return NULL;
+       morph->ran = isl_basic_set_params(morph->ran);
+       if (morph->ran)
+               return morph;
+
+       isl_morph_free(morph);
+       return NULL;
+}
+
 void isl_morph_dump(__isl_take isl_morph *morph, FILE *out)
 {
        if (!morph)
index 1a279af..3723448 100644 (file)
@@ -50,6 +50,8 @@ __isl_give isl_morph *isl_morph_remove_dom_dims(__isl_take isl_morph *morph,
        enum isl_dim_type type, unsigned first, unsigned n);
 __isl_give isl_morph *isl_morph_remove_ran_dims(__isl_take isl_morph *morph,
        enum isl_dim_type type, unsigned first, unsigned n);
+__isl_give isl_morph *isl_morph_dom_params(__isl_take isl_morph *morph);
+__isl_give isl_morph *isl_morph_ran_params(__isl_take isl_morph *morph);
 
 __isl_give isl_morph *isl_morph_compose(__isl_take isl_morph *morph1,
        __isl_take isl_morph *morph2);