add isl_basic_map_order_ge
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 14 Aug 2012 07:39:18 +0000 (09:39 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Thu, 6 Sep 2012 13:45:20 +0000 (15:45 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
doc/user.pod
include/isl/map.h
isl_map.c

index add08a6..1f27e60 100644 (file)
@@ -2089,6 +2089,10 @@ dimensions are equal to each other.
 Intersect the relation with the hyperplane where the given
 dimensions have opposite values.
 
+       __isl_give isl_basic_map *isl_basic_map_order_ge(
+               __isl_take isl_basic_map *bmap,
+               enum isl_dim_type type1, int pos1,
+               enum isl_dim_type type2, int pos2);
        __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
                enum isl_dim_type type1, int pos1,
                enum isl_dim_type type2, int pos2);
index 7f86644..621e2d1 100644 (file)
@@ -432,6 +432,8 @@ struct isl_map *isl_map_remove_inputs(struct isl_map *map,
 
 __isl_give isl_basic_map *isl_basic_map_equate(__isl_take isl_basic_map *bmap,
        enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2);
+__isl_give isl_basic_map *isl_basic_map_order_ge(__isl_take isl_basic_map *bmap,
+       enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2);
 __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
        enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2);
 __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
index a43f5af..9a5f5ea 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -10458,6 +10458,37 @@ error:
 }
 
 /* Add a constraint imposing that the value of the first dimension is
+ * greater than or equal to that of the second.
+ */
+__isl_give isl_basic_map *isl_basic_map_order_ge(__isl_take isl_basic_map *bmap,
+       enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2)
+{
+       isl_constraint *c;
+       isl_local_space *ls;
+
+       if (!bmap)
+               return NULL;
+
+       if (pos1 >= isl_basic_map_dim(bmap, type1))
+               isl_die(bmap->ctx, isl_error_invalid,
+                       "index out of bounds", return isl_basic_map_free(bmap));
+       if (pos2 >= isl_basic_map_dim(bmap, type2))
+               isl_die(bmap->ctx, isl_error_invalid,
+                       "index out of bounds", return isl_basic_map_free(bmap));
+
+       if (type1 == type2 && pos1 == pos2)
+               return bmap;
+
+       ls = isl_local_space_from_space(isl_basic_map_get_space(bmap));
+       c = isl_inequality_alloc(ls);
+       c = isl_constraint_set_coefficient_si(c, type1, pos1, 1);
+       c = isl_constraint_set_coefficient_si(c, type2, pos2, -1);
+       bmap = isl_basic_map_add_constraint(bmap, c);
+
+       return bmap;
+}
+
+/* Add a constraint imposing that the value of the first dimension is
  * greater than that of the second.
  */
 __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,