* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
*/
+#include <isl_ctx_private.h>
+#include <isl_map_private.h>
#include <isl/lp.h>
#include <isl/map.h>
-#include "isl_map_private.h"
#include <isl_mat_private.h>
#include <isl/set.h>
#include <isl/seq.h>
static struct isl_basic_set *uset_convex_hull_wrap_bounded(struct isl_set *set);
-static void swap_ineq(struct isl_basic_map *bmap, unsigned i, unsigned j)
-{
- isl_int *t;
-
- if (i != j) {
- t = bmap->ineq[i];
- bmap->ineq[i] = bmap->ineq[j];
- bmap->ineq[j] = t;
- }
-}
-
/* Return 1 if constraint c is redundant with respect to the constraints
* in bmap. If c is a lower [upper] bound in some variable and bmap
* does not have a lower [upper] bound in that variable, then c cannot
return -1;
}
-struct isl_basic_set *isl_basic_set_set_rational(struct isl_basic_set *bset)
+__isl_give isl_basic_map *isl_basic_map_set_rational(
+ __isl_take isl_basic_set *bmap)
{
- if (!bset)
+ if (!bmap)
return NULL;
- if (ISL_F_ISSET(bset, ISL_BASIC_MAP_RATIONAL))
- return bset;
+ if (ISL_F_ISSET(bmap, ISL_BASIC_MAP_RATIONAL))
+ return bmap;
- bset = isl_basic_set_cow(bset);
- if (!bset)
+ bmap = isl_basic_map_cow(bmap);
+ if (!bmap)
return NULL;
- ISL_F_SET(bset, ISL_BASIC_MAP_RATIONAL);
+ ISL_F_SET(bmap, ISL_BASIC_MAP_RATIONAL);
- return isl_basic_set_finalize(bset);
+ return isl_basic_map_finalize(bmap);
+}
+
+__isl_give isl_basic_set *isl_basic_set_set_rational(
+ __isl_take isl_basic_set *bset)
+{
+ return isl_basic_map_set_rational(bset);
}
static struct isl_set *isl_set_set_rational(struct isl_set *set)
n_ineq += set->p[i]->n_ineq;
}
lp = isl_basic_set_alloc(set->ctx, 0, dim * set->n, 0, n_eq, n_ineq);
+ lp = isl_basic_set_set_rational(lp);
if (!lp)
return NULL;
lp_dim = isl_basic_set_n_dim(lp);
if (!bset)
return -1;
- if (isl_basic_set_fast_is_empty(bset))
+ if (isl_basic_set_plain_is_empty(bset))
return 1;
tab = isl_tab_from_recession_cone(bset, 1);
if (!set || !lin)
goto error;
lin_dim = total - lin->n_eq;
- M = isl_mat_sub_alloc(set->ctx, lin->eq, 0, lin->n_eq, 1, total);
+ M = isl_mat_sub_alloc6(set->ctx, lin->eq, 0, lin->n_eq, 1, total);
M = isl_mat_left_hermite(M, 0, &U, &Q);
if (!M)
goto error;
isl_basic_set *lin, *aff;
int bounded1, bounded2;
+ if (bset1->ctx->opt->convex == ISL_CONVEX_HULL_FM)
+ return convex_hull_pair_elim(bset1, bset2);
+
aff = isl_set_affine_hull(isl_basic_set_union(isl_basic_set_copy(bset1),
isl_basic_set_copy(bset2)));
if (!aff)
total = isl_dim_total(set->dim);
for (i = 0; i < set->p[best]->n_ineq; ++i) {
- constraints[i].c = isl_mat_sub_alloc(hull->ctx,
+ constraints[i].c = isl_mat_sub_alloc6(hull->ctx,
set->p[best]->ineq + i, 0, 1, 0, 1 + total);
if (!constraints[i].c)
goto error;
if (isl_set_n_dim(set) == 1)
return convex_hull_1d(set);
- if (isl_set_is_bounded(set))
+ if (isl_set_is_bounded(set) &&
+ set->ctx->opt->convex == ISL_CONVEX_HULL_WRAP)
return uset_convex_hull_wrap(set);
lin = uset_combined_lineality_space(isl_set_copy(set));