add isl_union_map_fixed_power_val
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 9 Apr 2013 14:05:47 +0000 (16:05 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 28 May 2013 18:42:48 +0000 (20:42 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
doc/user.pod
include/isl/map.h
include/isl/union_map.h
isl_power_templ.c

index 48b4f79..6e665a3 100644 (file)
@@ -2697,8 +2697,15 @@ dualization algorithms or skip the elimination step.
 
        __isl_give isl_map *isl_map_fixed_power(
                __isl_take isl_map *map, isl_int exp);
+       __isl_give isl_map *isl_map_fixed_power_val(
+               __isl_take isl_map *map,
+               __isl_take isl_val *exp);
        __isl_give isl_union_map *isl_union_map_fixed_power(
                __isl_take isl_union_map *umap, isl_int exp);
+       __isl_give isl_union_map *
+       isl_union_map_fixed_power_val(
+               __isl_take isl_union_map *umap,
+               __isl_take isl_val *exp);
 
 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
index 421c8bc..6c469af 100644 (file)
@@ -619,6 +619,8 @@ int isl_map_foreach_basic_map(__isl_keep isl_map *map,
 __isl_give isl_map *isl_set_lifting(__isl_take isl_set *set);
 
 __isl_give isl_map *isl_map_fixed_power(__isl_take isl_map *map, isl_int exp);
+__isl_give isl_map *isl_map_fixed_power_val(__isl_take isl_map *map,
+       __isl_take isl_val *exp);
 __isl_give isl_map *isl_map_power(__isl_take isl_map *map, int *exact);
 __isl_give isl_map *isl_map_reaching_path_lengths(__isl_take isl_map *map,
        int *exact);
index 2ea5876..5084483 100644 (file)
@@ -5,6 +5,7 @@
 #include <isl/map_type.h>
 #include <isl/union_map_type.h>
 #include <isl/printer.h>
+#include <isl/val.h>
 
 #if defined(__cplusplus)
 extern "C" {
@@ -160,6 +161,8 @@ __isl_give isl_basic_map *isl_union_map_sample(__isl_take isl_union_map *umap);
 
 __isl_give isl_union_map *isl_union_map_fixed_power(
        __isl_take isl_union_map *umap, isl_int exp);
+__isl_give isl_union_map *isl_union_map_fixed_power_val(
+       __isl_take isl_union_map *umap, __isl_take isl_val *exp);
 __isl_give isl_union_map *isl_union_map_power(__isl_take isl_union_map *umap,
        int *exact);
 __isl_give isl_union_map *isl_union_map_transitive_closure(
index b9fc559..65253bd 100644 (file)
@@ -1,3 +1,5 @@
+#include <isl_val_private.h>
+
 #define xFN(TYPE,NAME) TYPE ## _ ## NAME
 #define FN(TYPE,NAME) xFN(TYPE,NAME)
 
@@ -56,3 +58,24 @@ error:
        FN(TYPE,free)(map);
        return NULL;
 }
+
+/* Compute the given non-zero power of "map" and return the result.
+ * If the exponent "exp" is negative, then the -exp th power of the inverse
+ * relation is computed.
+ */
+__isl_give TYPE *FN(TYPE,fixed_power_val)(__isl_take TYPE *map,
+       __isl_take isl_val *exp)
+{
+       if (!map || !exp)
+               goto error;
+       if (!isl_val_is_int(exp))
+               isl_die(FN(TYPE,get_ctx)(map), isl_error_invalid,
+                       "expecting integer exponent", goto error);
+       map = FN(TYPE,fixed_power)(map, exp->n);
+       isl_val_free(exp);
+       return map;
+error:
+       FN(TYPE,free)(map);
+       isl_val_free(exp);
+       return NULL;
+}