return NULL;
if (isl_set_is_empty(set))
- convex_hull = isl_basic_set_empty(set->ctx, 0, 0);
+ convex_hull = isl_basic_set_empty(isl_dim_copy(set->dim));
else
- convex_hull = isl_basic_set_universe(set->ctx, 0, 0);
+ convex_hull = isl_basic_set_universe(isl_dim_copy(set->dim));
isl_set_free(set);
return convex_hull;
}
set = isl_set_remove_empty_parts(set);
if (!set)
return NULL;
- if (isl_set_n_dim(set) == 0) {
- convex_hull = isl_basic_set_empty(set->ctx, 0, 0);
- isl_set_free(set);
- return convex_hull;
- }
if (set->n == 1) {
convex_hull = isl_basic_set_copy(set->p[0]);
isl_set_free(set);
struct isl_mat *bounds;
if (isl_set_n_dim(set) == 0) {
- convex_hull = isl_basic_set_universe(set->ctx, 0, 0);
+ convex_hull = isl_basic_set_universe(isl_dim_copy(set->dim));
isl_set_free(set);
convex_hull = isl_basic_set_set_rational(convex_hull);
return convex_hull;
struct isl_basic_map *isl_map_convex_hull(struct isl_map *map)
{
struct isl_basic_set *bset;
+ struct isl_basic_map *model = NULL;
struct isl_basic_set *affine_hull = NULL;
struct isl_basic_map *convex_hull = NULL;
struct isl_set *set = NULL;
return convex_hull;
}
- set = isl_map_underlying_set(isl_map_copy(map));
+ map = isl_map_align_divs(map);
+ model = isl_basic_map_copy(map->p[0]);
+ set = isl_map_underlying_set(map);
if (!set)
goto error;
bset = uset_convex_hull(set);
}
- convex_hull = isl_basic_map_overlying_set(bset,
- isl_basic_map_copy(map->p[0]));
+ convex_hull = isl_basic_map_overlying_set(bset, model);
- isl_map_free(map);
F_CLR(convex_hull, ISL_BASIC_MAP_RATIONAL);
return convex_hull;
error:
isl_set_free(set);
- isl_map_free(map);
+ isl_basic_map_free(model);
return NULL;
}
/* Compute a superset of the convex hull of map that is described
* by only translates of the constraints in the constituents of map.
+ *
+ * The implementation is not very efficient. In particular, if
+ * constraints with the same normal appear in more than one
+ * basic map, they will be (re)examined each time.
*/
struct isl_basic_map *isl_map_simple_hull(struct isl_map *map)
{
struct isl_set *set = NULL;
+ struct isl_basic_map *model = NULL;
struct isl_basic_map *hull;
struct isl_basic_set *bset = NULL;
int i, j;
return hull;
}
+ map = isl_map_align_divs(map);
+ model = isl_basic_map_copy(map->p[0]);
+
n_ineq = 0;
for (i = 0; i < map->n; ++i) {
if (!map->p[i])
n_ineq += map->p[i]->n_ineq;
}
- set = isl_map_underlying_set(isl_map_copy(map));
+ set = isl_map_underlying_set(map);
if (!set)
goto error;
bset = isl_basic_set_finalize(bset);
bset = isl_basic_set_convex_hull(bset);
- hull = isl_basic_map_overlying_set(bset, isl_basic_map_copy(map->p[0]));
+ hull = isl_basic_map_overlying_set(bset, isl_basic_map_copy(model));
isl_set_free(set);
- isl_map_free(map);
return hull;
error:
isl_basic_set_free(bset);
isl_set_free(set);
- isl_map_free(map);
+ isl_basic_map_free(model);
return NULL;
}