add isl_map_identity_like
authorSven Verdoolaege <skimo@kotnet.org>
Sun, 30 Aug 2009 07:11:09 +0000 (09:11 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Sun, 30 Aug 2009 07:11:09 +0000 (09:11 +0200)
include/isl_map.h
isl_map.c

index 3517e4c..4b5cad9 100644 (file)
@@ -213,6 +213,7 @@ struct isl_map *isl_map_empty_like_basic_map(struct isl_basic_map *model);
 struct isl_map *isl_map_dup(struct isl_map *map);
 struct isl_map *isl_map_add(struct isl_map *map, struct isl_basic_map *bmap);
 struct isl_map *isl_map_identity(struct isl_dim *set_dim);
+struct isl_map *isl_map_identity_like(struct isl_map *model);
 struct isl_map *isl_map_identity_like_basic_map(struct isl_basic_map *model);
 struct isl_map *isl_map_finalize(struct isl_map *map);
 void isl_map_free(struct isl_map *map);
index d31775b..3d69a09 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -3688,6 +3688,15 @@ struct isl_map *isl_map_identity(struct isl_dim *set_dim)
        return map_identity(dim);
 }
 
+struct isl_map *isl_map_identity_like(struct isl_map *model)
+{
+       if (!model || !model->dim)
+               return NULL;
+       isl_assert(model->ctx,
+                       model->dim->n_in == model->dim->n_out, return NULL);
+       return map_identity(isl_dim_copy(model->dim));
+}
+
 struct isl_map *isl_map_identity_like_basic_map(struct isl_basic_map *model)
 {
        if (!model || !model->dim)