add isl_pw_multi_aff_get_pw_aff
[platform/upstream/isl.git] / isl_local_space.c
index 0bbd0e0..a57fff1 100644 (file)
@@ -532,6 +532,21 @@ __isl_give isl_local_space *isl_local_space_domain(
        return ls;
 }
 
+__isl_give isl_local_space *isl_local_space_range(
+       __isl_take isl_local_space *ls)
+{
+       ls = isl_local_space_drop_dims(ls, isl_dim_in,
+                                       0, isl_local_space_dim(ls, isl_dim_in));
+       ls = isl_local_space_cow(ls);
+       if (!ls)
+               return NULL;
+
+       ls->dim = isl_space_range(ls->dim);
+       if (!ls->dim)
+               return isl_local_space_free(ls);
+       return ls;
+}
+
 /* Construct a local space for a map that has the given local
  * space as domain and that has a zero-dimensional range.
  */
@@ -856,3 +871,27 @@ __isl_give isl_local_space *isl_local_space_lift(
 
        return ls;
 }
+
+/* Construct a basic map that maps a set living in local space "ls"
+ * to the corresponding lifted local space.
+ */
+__isl_give isl_basic_map *isl_local_space_lifting(
+       __isl_take isl_local_space *ls)
+{
+       isl_basic_map *lifting;
+       isl_basic_set *bset;
+
+       if (!ls)
+               return NULL;
+       if (!isl_local_space_is_set(ls))
+               isl_die(isl_local_space_get_ctx(ls), isl_error_invalid,
+                       "lifting only defined on set spaces",
+                       return isl_local_space_free(ls));
+
+       bset = isl_basic_set_from_local_space(ls);
+       lifting = isl_basic_set_unwrap(isl_basic_set_lift(bset));
+       lifting = isl_basic_map_domain_map(lifting);
+       lifting = isl_basic_map_reverse(lifting);
+
+       return lifting;
+}