- * The power is given by parameter "param". If the result is exact,
- * then *exact is set to 1.
+ * The result maps the exponent to a nested copy of the corresponding power.
+ * If the result is exact, then *exact is set to 1.
* map_power constructs an extended relation with the path lengths
* encoded as the difference between the final coordinates.
* map_power constructs an extended relation with the path lengths
* encoded as the difference between the final coordinates.
- * In the final step, this difference is equated to the parameter "param"
- * and made positive. The extra coordinates are subsequently projected out.
+ * In the final step, this difference is equated to an extra parameter
+ * and made positive. The extra coordinates are subsequently projected out
+ * and the parameter is turned into the domain of the result.
- if (isl_map_fast_is_empty(map))
+ if (isl_map_fast_is_empty(map)) {
+ map = isl_map_from_range(isl_map_wrap(map));
+ map = isl_map_add_dims(map, isl_dim_in, 1);
+ map = isl_map_set_dim_name(map, isl_dim_in, 0, "k");
+ target_dim = isl_dim_from_range(isl_dim_wrap(target_dim));
+ target_dim = isl_dim_add(target_dim, isl_dim_in, 1);
+ target_dim = isl_dim_set_name(target_dim, isl_dim_in, 0, "k");
+
dim = isl_map_get_dim(map);
diff = equate_parameter_to_length(dim, param);
map = isl_map_intersect(map, diff);
map = isl_map_project_out(map, isl_dim_in, d, 1);
map = isl_map_project_out(map, isl_dim_out, d, 1);
dim = isl_map_get_dim(map);
diff = equate_parameter_to_length(dim, param);
map = isl_map_intersect(map, diff);
map = isl_map_project_out(map, isl_dim_in, d, 1);
map = isl_map_project_out(map, isl_dim_out, d, 1);
+ map = isl_map_from_range(isl_map_wrap(map));
+ map = isl_map_move_dims(map, isl_dim_in, 0, isl_dim_param, param, 1);