add isl_local_space_drop_dims
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 28 Jun 2011 18:36:00 +0000 (20:36 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Thu, 30 Jun 2011 12:17:22 +0000 (14:17 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
doc/user.pod
include/isl/local_space.h
isl_local_space.c

index afc905c..647adcd 100644 (file)
@@ -626,6 +626,9 @@ using the following functions.
        __isl_give isl_local_space *isl_local_space_add_dims(
                __isl_take isl_local_space *ls,
                enum isl_dim_type type, unsigned n);
+       __isl_give isl_local_space *isl_local_space_drop_dims(
+               __isl_take isl_local_space *ls,
+               enum isl_dim_type type, unsigned first, unsigned n);
 
 =head2 Input and Output
 
index 664f4fb..4636871 100644 (file)
@@ -34,6 +34,9 @@ __isl_give isl_local_space *isl_local_space_from_domain(
        __isl_take isl_local_space *ls);
 __isl_give isl_local_space *isl_local_space_add_dims(
        __isl_take isl_local_space *ls, enum isl_dim_type type, unsigned n);
+__isl_give isl_local_space *isl_local_space_drop_dims(
+       __isl_take isl_local_space *ls,
+       enum isl_dim_type type, unsigned first, unsigned n);
 
 int isl_local_space_is_equal(__isl_keep isl_local_space *ls1,
        __isl_keep isl_local_space *ls2);
index a7d581f..8a6b919 100644 (file)
@@ -471,3 +471,39 @@ int isl_local_space_is_named_or_nested(__isl_keep isl_local_space *ls,
                return -1;
        return isl_dim_is_named_or_nested(ls->dim, type);
 }
+
+__isl_give isl_local_space *isl_local_space_drop_dims(
+       __isl_take isl_local_space *ls,
+       enum isl_dim_type type, unsigned first, unsigned n)
+{
+       isl_ctx *ctx;
+
+       if (!ls)
+               return NULL;
+       if (n == 0 && !isl_local_space_is_named_or_nested(ls, type))
+               return ls;
+
+       ctx = isl_local_space_get_ctx(ls);
+       if (first + n > isl_local_space_dim(ls, type))
+               isl_die(ctx, isl_error_invalid, "range out of bounds",
+                       return isl_local_space_free(ls));
+
+       ls = isl_local_space_cow(ls);
+       if (!ls)
+               return NULL;
+
+       if (type == isl_dim_div) {
+               ls->div = isl_mat_drop_rows(ls->div, first, n);
+       } else {
+               ls->dim = isl_dim_drop(ls->dim, type, first, n);
+               if (!ls->dim)
+                       return isl_local_space_free(ls);
+       }
+
+       first += 1 + isl_local_space_offset(ls, type);
+       ls->div = isl_mat_drop_cols(ls->div, first, n);
+       if (!ls->div)
+               return isl_local_space_free(ls);
+
+       return ls;
+}