* for a single dimension.
*
* If the resulting multi piecewise affine expression has
- * an explicit domain, then assign it the parameter domain of the input.
- * In other cases, the parameter domain is stored in the individual elements.
+ * an explicit domain, then assign it the (parameter) domain of the input.
+ * In other cases, the (parameter) domain is stored in the individual elements.
*/
static __isl_give isl_multi_pw_aff *FN(BASE,opt_mpa)(__isl_take TYPE *obj,
__isl_give isl_pw_aff *(*opt)(__isl_take TYPE *obj, int pos))
@@ -42,8 +42,8 @@ static __isl_give isl_multi_pw_aff *FN(BASE,opt_mpa)(__isl_take TYPE *obj,
if (isl_multi_pw_aff_has_explicit_domain(mpa)) {
isl_set *dom;
- dom = FN(TYPE,params)(FN(TYPE,copy)(obj));
- mpa = isl_multi_pw_aff_intersect_params(mpa, dom);
+ dom = FN(TYPE,domain)(FN(TYPE,copy)(obj));
+ mpa = isl_multi_pw_aff_intersect_domain(mpa, dom);
}
FN(TYPE,free)(obj);
@@ -10095,6 +10095,48 @@ static isl_stat test_multi_pw_aff_3(isl_ctx *ctx)
return isl_stat_ok;
}
+/* String descriptions of boxes that
+ * are used for reconstructing box maps from their lower and upper bounds.
+ */
+static const char *multi_pw_aff_box_tests[] = {
+ "{ A[x, y] -> [] : x + y >= 0 }",
+ "[N] -> { A[x, y] -> [x] : x + y <= N }",
+ "[N] -> { A[x, y] -> [x : y] : x + y <= N }",
+};
+
+/* Check that map representations of boxes can be reconstructed
+ * from their lower and upper bounds.
+ */
+static isl_stat test_multi_pw_aff_box(isl_ctx *ctx)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(multi_pw_aff_box_tests); ++i) {
+ const char *str;
+ isl_bool equal;
+ isl_map *map, *box;
+ isl_multi_pw_aff *min, *max;
+
+ str = multi_pw_aff_box_tests[i];
+ map = isl_map_read_from_str(ctx, str);
+ min = isl_map_min_multi_pw_aff(isl_map_copy(map));
+ max = isl_map_max_multi_pw_aff(isl_map_copy(map));
+ box = isl_map_universe(isl_map_get_space(map));
+ box = isl_map_lower_bound_multi_pw_aff(box, min);
+ box = isl_map_upper_bound_multi_pw_aff(box, max);
+ equal = isl_map_is_equal(map, box);
+ isl_map_free(map);
+ isl_map_free(box);
+ if (equal < 0)
+ return isl_stat_error;
+ if (!equal)
+ isl_die(ctx, isl_error_unknown,
+ "unexpected result", return isl_stat_error);
+ }
+
+ return isl_stat_ok;
+}
+
/* Perform some tests on multi piecewise affine expressions.
*/
static int test_multi_pw_aff(isl_ctx *ctx)
@@ -10105,6 +10147,8 @@ static int test_multi_pw_aff(isl_ctx *ctx)
return -1;
if (test_multi_pw_aff_3(ctx) < 0)
return -1;
+ if (test_multi_pw_aff_box(ctx) < 0)
+ return -1;
return 0;
}