return bmap;
tab = isl_tab_from_basic_map(bmap);
- tab = isl_tab_detect_implicit_equalities(tab);
+ if (isl_tab_detect_implicit_equalities(tab) < 0)
+ goto error;
if (isl_tab_detect_redundant(tab) < 0)
goto error;
bmap = isl_basic_map_update_from_tab(bmap, tab);
int i;
unsigned dim;
+ if (!bset)
+ return NULL;
+
if (ISL_F_ISSET(bset, ISL_BASIC_SET_EMPTY))
return bset;
isl_int *facet, isl_int *ridge)
{
int i;
+ isl_ctx *ctx;
struct isl_mat *T = NULL;
struct isl_basic_set *lp = NULL;
struct isl_vec *obj;
isl_int num, den;
unsigned dim;
+ if (!set)
+ return NULL;
+ ctx = set->ctx;
set = isl_set_copy(set);
set = isl_set_set_rational(set);
dim = 1 + isl_set_n_dim(set);
- T = isl_mat_alloc(set->ctx, 3, dim);
+ T = isl_mat_alloc(ctx, 3, dim);
if (!T)
goto error;
isl_int_set_si(T->row[0][0], 1);
if (!set)
goto error;
lp = wrap_constraints(set);
- obj = isl_vec_alloc(set->ctx, 1 + dim*set->n);
+ obj = isl_vec_alloc(ctx, 1 + dim*set->n);
if (!obj)
goto error;
isl_int_set_si(obj->block.data[0], 0);
isl_int_init(num);
isl_int_init(den);
res = isl_basic_set_solve_lp(lp, 0,
- obj->block.data, set->ctx->one, &num, &den, NULL);
+ obj->block.data, ctx->one, &num, &den, NULL);
if (res == isl_lp_ok) {
isl_int_neg(num, num);
isl_seq_combine(facet, num, facet, den, ridge, dim);
isl_vec_free(obj);
isl_basic_set_free(lp);
isl_set_free(set);
- isl_assert(set->ctx, res == isl_lp_ok || res == isl_lp_unbounded,
+ if (res == isl_lp_error)
+ return NULL;
+ isl_assert(ctx, res == isl_lp_ok || res == isl_lp_unbounded,
return NULL);
return facet;
error:
{
struct isl_set *slice = NULL;
struct isl_basic_set *face = NULL;
- struct isl_mat *m, *U, *Q;
int i;
unsigned dim = isl_set_n_dim(set);
int is_bound;
set = isl_set_preimage(set, U);
facet = uset_convex_hull_wrap_bounded(set);
facet = isl_basic_set_preimage(facet, Q);
- isl_assert(ctx, facet->n_eq == 0, goto error);
+ if (facet)
+ isl_assert(ctx, facet->n_eq == 0, goto error);
return facet;
error:
isl_basic_set_free(facet);
return NULL;
}
-static int isl_basic_set_is_bounded(struct isl_basic_set *bset)
+/* Is the set bounded for each value of the parameters?
+ */
+int isl_basic_set_is_bounded(__isl_keep isl_basic_set *bset)
{
struct isl_tab *tab;
int bounded;
if (isl_basic_set_fast_is_empty(bset))
return 1;
- tab = isl_tab_from_recession_cone(bset);
+ tab = isl_tab_from_recession_cone(bset, 1);
bounded = isl_tab_cone_is_bounded(tab);
isl_tab_free(tab);
return bounded;
}
+/* Is the set bounded for each value of the parameters?
+ */
int isl_set_is_bounded(__isl_keep isl_set *set)
{
int i;
+ if (!set)
+ return -1;
+
for (i = 0; i < set->n; ++i) {
int bounded = isl_basic_set_is_bounded(set->p[i]);
if (!bounded || bounded < 0)
{
struct isl_basic_set *convex_hull = NULL;
+ if (!set)
+ goto error;
+
if (isl_set_n_dim(set) == 0) {
convex_hull = isl_basic_set_universe(isl_dim_copy(set->dim));
isl_set_free(set);
}
set = isl_set_set_rational(set);
-
- if (!set)
- goto error;
set = isl_set_coalesce(set);
if (!set)
goto error;
}
convex_hull = isl_basic_map_overlying_set(bset, model);
+ if (!convex_hull)
+ return NULL;
ISL_F_SET(convex_hull, ISL_BASIC_MAP_NO_IMPLICIT);
ISL_F_SET(convex_hull, ISL_BASIC_MAP_ALL_EQUALITIES);