* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
*/
+#include <strings.h>
+#include <isl_ctx_private.h>
+#include <isl_map_private.h>
#include "isl_equalities.h"
-#include "isl_map.h"
-#include "isl_map_private.h"
-#include "isl_seq.h"
+#include <isl/map.h>
+#include <isl/seq.h>
#include "isl_tab.h"
+#include <isl_space_private.h>
+#include <isl_mat_private.h>
static void swap_equality(struct isl_basic_map *bmap, int a, int b)
{
}
}
-static void set_swap_inequality(struct isl_basic_set *bset, int a, int b)
-{
- swap_inequality((struct isl_basic_map *)bset, a, b);
-}
-
static void constraint_drop_vars(isl_int *c, unsigned n, unsigned rem)
{
isl_seq_cpy(c, c + n, rem);
isl_assert(bset->ctx, first + n <= bset->dim->n_out, goto error);
- if (n == 0)
+ if (n == 0 && !isl_space_get_tuple_name(bset->dim, isl_dim_set))
return bset;
bset = isl_basic_set_cow(bset);
constraint_drop_vars(bset->div[i]+1+1+bset->dim->nparam+first, n,
(bset->dim->n_out-first-n)+bset->extra);
- bset->dim = isl_dim_drop_outputs(bset->dim, first, n);
+ bset->dim = isl_space_drop_outputs(bset->dim, first, n);
if (!bset->dim)
goto error;
isl_assert(set->ctx, first + n <= set->dim->n_out, goto error);
- if (n == 0)
+ if (n == 0 && !isl_space_get_tuple_name(set->dim, isl_dim_set))
return set;
set = isl_set_cow(set);
if (!set)
goto error;
- set->dim = isl_dim_drop_outputs(set->dim, first, n);
+ set->dim = isl_space_drop_outputs(set->dim, first, n);
if (!set->dim)
goto error;
dim = isl_basic_map_dim(bmap, type);
isl_assert(bmap->ctx, first + n <= dim, goto error);
- if (n == 0)
+ if (n == 0 && !isl_space_is_named_or_nested(bmap->dim, type))
return bmap;
bmap = isl_basic_map_cow(bmap);
goto error;
isl_basic_map_free_div(bmap, n);
} else
- bmap->dim = isl_dim_drop(bmap->dim, type, first, n);
+ bmap->dim = isl_space_drop_dims(bmap->dim, type, first, n);
if (!bmap->dim)
goto error;
isl_assert(map->ctx, first + n <= isl_map_dim(map, type), goto error);
- if (n == 0)
+ if (n == 0 && !isl_space_get_tuple_name(map->dim, type))
return map;
map = isl_map_cow(map);
if (!map)
goto error;
- map->dim = isl_dim_drop(map->dim, type, first, n);
+ map->dim = isl_space_drop_dims(map->dim, type, first, n);
if (!map->dim)
goto error;
if (!bmap)
goto error;
- pos = 1 + isl_dim_total(bmap->dim) + div;
+ pos = 1 + isl_space_dim(bmap->dim, isl_dim_all) + div;
isl_assert(bmap->ctx, div < bmap->n_div, goto error);
unsigned pos, isl_int *eq, int keep_divs, int *progress)
{
unsigned total;
+ unsigned space_total;
int k;
int last_div;
total = isl_basic_map_total_dim(bmap);
- last_div = isl_seq_last_non_zero(eq + 1 + isl_dim_total(bmap->dim),
- bmap->n_div);
+ space_total = isl_space_dim(bmap->dim, isl_dim_all);
+ last_div = isl_seq_last_non_zero(eq + 1 + space_total, bmap->n_div);
for (k = 0; k < bmap->n_eq; ++k) {
if (bmap->eq[k] == eq)
continue;
if (progress)
*progress = 1;
isl_seq_elim(bmap->eq[k], eq, 1+pos, 1+total, NULL);
+ isl_seq_normalize(bmap->ctx, bmap->eq[k], 1 + total);
}
for (k = 0; k < bmap->n_ineq; ++k) {
if (progress)
*progress = 1;
isl_seq_elim(bmap->ineq[k], eq, 1+pos, 1+total, NULL);
+ isl_seq_normalize(bmap->ctx, bmap->ineq[k], 1 + total);
ISL_F_CLR(bmap, ISL_BASIC_MAP_NORMALIZED);
}
static void eliminate_div(struct isl_basic_map *bmap, isl_int *eq,
unsigned div, int keep_divs)
{
- unsigned pos = isl_dim_total(bmap->dim) + div;
+ unsigned pos = isl_space_dim(bmap->dim, isl_dim_all) + div;
eliminate_var_using_equality(bmap, pos, eq, keep_divs, NULL);
{
int k;
int last_div;
- unsigned pos = isl_dim_total(bmap->dim) + div;
+ unsigned space_total = isl_space_dim(bmap->dim, isl_dim_all);
+ unsigned pos = space_total + div;
- last_div = isl_seq_last_non_zero(eq + 1 + isl_dim_total(bmap->dim),
- bmap->n_div);
+ last_div = isl_seq_last_non_zero(eq + 1 + space_total, bmap->n_div);
if (last_div < 0 || last_div <= div)
return 1;
if (!bmap)
return NULL;
- off = 1 + isl_dim_total(bmap->dim);
+ off = 1 + isl_space_dim(bmap->dim, isl_dim_all);
for (d = bmap->n_div - 1; d >= 0 ; --d) {
for (i = 0; i < bmap->n_eq; ++i) {
return NULL;
ctx = bmap->ctx;
- off = 1 + isl_dim_total(bmap->dim);
+ off = 1 + isl_space_dim(bmap->dim, isl_dim_all);
for (d = bmap->n_div - 1; d >= 0 ; --d) {
for (i = 0; i < bmap->n_eq; ++i)
continue;
*progress = 1;
bmap = isl_basic_map_eliminate_vars(bmap, (off-1)+d, 1);
- if (ISL_F_ISSET(bmap, ISL_BASIC_MAP_EMPTY))
+ if (!bmap || ISL_F_ISSET(bmap, ISL_BASIC_MAP_EMPTY))
break;
bmap = isl_basic_map_drop_div(bmap, d);
if (!bmap)
int k, l, h;
int bits;
struct isl_blk eq;
- unsigned total_var = isl_dim_total(bmap->dim);
- unsigned total = total_var + bmap->n_div;
+ unsigned total_var;
+ unsigned total;
struct isl_ctx *ctx;
- if (bmap->n_div <= 1)
+ if (!bmap || bmap->n_div <= 1)
return bmap;
+ total_var = isl_space_dim(bmap->dim, isl_dim_all);
+ total = total_var + bmap->n_div;
+
ctx = bmap->ctx;
for (k = bmap->n_div - 1; k >= 0; --k)
if (!isl_int_is_zero(bmap->div[k][0]))
int i, j;
unsigned total;
- total = isl_dim_total(bmap->dim);
+ total = isl_space_dim(bmap->dim, isl_dim_all);
for (i = 0, j = bmap->n_div-1; i < bmap->n_eq; ++i) {
while (j >= 0 && isl_int_is_zero(bmap->eq[i][1 + total + j]))
--j;
if (ISL_F_ISSET(bmap, ISL_BASIC_MAP_NORMALIZED_DIVS))
return bmap;
- total = isl_dim_total(bmap->dim);
+ total = isl_space_dim(bmap->dim, isl_dim_all);
div_eq = n_pure_div_eq(bmap);
if (div_eq == 0)
return bmap;
if (div_eq < bmap->n_eq) {
- B = isl_mat_sub_alloc(bmap->ctx, bmap->eq, div_eq,
+ B = isl_mat_sub_alloc6(bmap->ctx, bmap->eq, div_eq,
bmap->n_eq - div_eq, 0, 1 + total);
C = isl_mat_variable_compression(B, &C2);
if (!C || !C2)
--j;
isl_int_set(d->block.data[i], bmap->eq[i][1 + total + j]);
}
- B = isl_mat_sub_alloc(bmap->ctx, bmap->eq, 0, div_eq, 0, 1 + total);
+ B = isl_mat_sub_alloc6(bmap->ctx, bmap->eq, 0, div_eq, 0, 1 + total);
if (C) {
B = isl_mat_product(B, C);
}
isl_int_clear(v);
pos = isl_alloc_array(bmap->ctx, int, T->n_row);
+ if (!pos)
+ goto error;
/* We have to be careful because dropping equalities may reorder them */
dropped = 0;
for (j = bmap->n_div - 1; j >= 0; --j) {
needed++;
}
if (needed > dropped) {
- bmap = isl_basic_map_extend_dim(bmap, isl_dim_copy(bmap->dim),
+ bmap = isl_basic_map_extend_space(bmap, isl_space_copy(bmap->dim),
needed, needed, 0);
if (!bmap)
goto error;
static struct isl_basic_map *set_div_from_lower_bound(
struct isl_basic_map *bmap, int div, int ineq)
{
- unsigned total = 1 + isl_dim_total(bmap->dim);
+ unsigned total = 1 + isl_space_dim(bmap->dim, isl_dim_all);
isl_seq_neg(bmap->div[div] + 1, bmap->ineq[ineq], total + bmap->n_div);
isl_int_set(bmap->div[div][0], bmap->ineq[ineq][total + div]);
int div, int ineq)
{
int j;
- unsigned total = 1 + isl_dim_total(bmap->dim);
+ unsigned total = 1 + isl_space_dim(bmap->dim, isl_dim_all);
/* Not defined in terms of unknown divs */
for (j = 0; j < bmap->n_div; ++j) {
struct isl_basic_map *bmap, int k, int l, isl_int sum, int *progress)
{
int i;
- unsigned total = 1 + isl_dim_total(bmap->dim);
+ unsigned total = 1 + isl_space_dim(bmap->dim, isl_dim_all);
for (i = 0; i < bmap->n_div; ++i) {
if (!isl_int_is_zero(bmap->div[i][0]))
}
static struct isl_basic_map *remove_duplicate_constraints(
- struct isl_basic_map *bmap, int *progress)
+ struct isl_basic_map *bmap, int *progress, int detect_divs)
{
unsigned int size;
isl_int ***index;
int bits;
unsigned total = isl_basic_map_total_dim(bmap);
isl_int sum;
+ isl_ctx *ctx;
- if (bmap->n_ineq <= 1)
+ if (!bmap || bmap->n_ineq <= 1)
return bmap;
size = round_up(4 * (bmap->n_ineq+1) / 3 - 1);
bits = ffs(size) - 1;
+ ctx = isl_basic_map_get_ctx(bmap);
index = isl_calloc_array(ctx, isl_int **, size);
if (!index)
return bmap;
l = index[h] - &bmap->ineq[0];
isl_int_add(sum, bmap->ineq[k][0], bmap->ineq[l][0]);
if (isl_int_is_pos(sum)) {
- bmap = check_for_div_constraints(bmap, k, l, sum,
- progress);
+ if (detect_divs)
+ bmap = check_for_div_constraints(bmap, k, l,
+ sum, progress);
continue;
}
if (isl_int_is_zero(sum)) {
bmap = isl_basic_map_gauss(bmap, &progress);
/* requires equalities in normal form */
bmap = normalize_divs(bmap, &progress);
- bmap = remove_duplicate_constraints(bmap, &progress);
+ bmap = remove_duplicate_constraints(bmap, &progress, 1);
}
return bmap;
}
}
+int isl_basic_map_is_div_constraint(__isl_keep isl_basic_map *bmap,
+ isl_int *constraint, unsigned div)
+{
+ unsigned pos;
+
+ if (!bmap)
+ return -1;
+
+ pos = 1 + isl_space_dim(bmap->dim, isl_dim_all) + div;
+
+ if (isl_int_eq(constraint[pos], bmap->div[div][0])) {
+ int neg;
+ isl_int_sub(bmap->div[div][1],
+ bmap->div[div][1], bmap->div[div][0]);
+ isl_int_add_ui(bmap->div[div][1], bmap->div[div][1], 1);
+ neg = isl_seq_is_neg(constraint, bmap->div[div]+1, pos);
+ isl_int_sub_ui(bmap->div[div][1], bmap->div[div][1], 1);
+ isl_int_add(bmap->div[div][1],
+ bmap->div[div][1], bmap->div[div][0]);
+ if (!neg)
+ return 0;
+ if (isl_seq_first_non_zero(constraint+pos+1,
+ bmap->n_div-div-1) != -1)
+ return 0;
+ } else if (isl_int_abs_eq(constraint[pos], bmap->div[div][0])) {
+ if (!isl_seq_eq(constraint, bmap->div[div]+1, pos))
+ return 0;
+ if (isl_seq_first_non_zero(constraint+pos+1,
+ bmap->n_div-div-1) != -1)
+ return 0;
+ } else
+ return 0;
+
+ return 1;
+}
+
+
/* If the only constraints a div d=floor(f/m)
* appears in are its two defining constraints
*
static int div_is_redundant(struct isl_basic_map *bmap, int div)
{
int i;
- unsigned pos = 1 + isl_dim_total(bmap->dim) + div;
+ unsigned pos = 1 + isl_space_dim(bmap->dim, isl_dim_all) + div;
for (i = 0; i < bmap->n_eq; ++i)
if (!isl_int_is_zero(bmap->eq[i][pos]))
for (i = 0; i < bmap->n_ineq; ++i) {
if (isl_int_is_zero(bmap->ineq[i][pos]))
continue;
- if (isl_int_eq(bmap->ineq[i][pos], bmap->div[div][0])) {
- int neg;
- isl_int_sub(bmap->div[div][1],
- bmap->div[div][1], bmap->div[div][0]);
- isl_int_add_ui(bmap->div[div][1], bmap->div[div][1], 1);
- neg = isl_seq_is_neg(bmap->ineq[i], bmap->div[div]+1, pos);
- isl_int_sub_ui(bmap->div[div][1], bmap->div[div][1], 1);
- isl_int_add(bmap->div[div][1],
- bmap->div[div][1], bmap->div[div][0]);
- if (!neg)
- return 0;
- if (isl_seq_first_non_zero(bmap->ineq[i]+pos+1,
- bmap->n_div-div-1) != -1)
- return 0;
- } else if (isl_int_abs_eq(bmap->ineq[i][pos], bmap->div[div][0])) {
- if (!isl_seq_eq(bmap->ineq[i], bmap->div[div]+1, pos))
- return 0;
- if (isl_seq_first_non_zero(bmap->ineq[i]+pos+1,
- bmap->n_div-div-1) != -1)
- return 0;
- } else
+ if (!isl_basic_map_is_div_constraint(bmap, bmap->ineq[i], div))
return 0;
}
}
bmap = isl_basic_map_extend_constraints(bmap,
0, n_lower * n_upper);
+ if (!bmap)
+ goto error;
for (i = bmap->n_ineq - 1; i >= 0; --i) {
int last;
if (isl_int_is_zero(bmap->ineq[i][1+d]))
}
if (n_lower > 0 && n_upper > 0) {
bmap = isl_basic_map_normalize_constraints(bmap);
- bmap = remove_duplicate_constraints(bmap, NULL);
+ bmap = remove_duplicate_constraints(bmap, NULL, 0);
bmap = isl_basic_map_gauss(bmap, NULL);
- bmap = isl_basic_map_convex_hull(bmap);
+ bmap = isl_basic_map_remove_redundancies(bmap);
if (!bmap)
goto error;
if (ISL_F_ISSET(bmap, ISL_BASIC_MAP_EMPTY))
int d, i;
unsigned total;
- total = isl_dim_total(bmap->dim);
+ total = isl_space_dim(bmap->dim, isl_dim_all);
for (d = 0; d < total; ++d)
elim[d] = -1;
for (i = 0; i < bmap->n_eq; ++i) {
int copied = 0;
unsigned total;
- total = isl_dim_total(bmap->dim);
+ total = isl_space_dim(bmap->dim, isl_dim_all);
for (d = total - 1; d >= 0; --d) {
if (isl_int_is_zero(src[1+d]))
continue;
isl_int ***index;
int bits;
int k, h, l;
+ isl_ctx *ctx;
if (!bset)
return NULL;
size = round_up(4 * (context->n_ineq+1) / 3 - 1);
bits = ffs(size) - 1;
+ ctx = isl_basic_set_get_ctx(bset);
index = isl_calloc_array(ctx, isl_int **, size);
if (!index)
return bset;
return bset;
}
-/* Tighten (decrease) the constant terms of the inequalities based
- * on the equalities, without removing any integer points.
- * For example, if there is an equality
- *
- * i = 3 * j
- *
- * and an inequality
- *
- * i >= 1
- *
- * then we want to replace the inequality by
- *
- * i >= 3
- *
- * We do this by computing a variable compression and translating
- * the constraints to the compressed space.
- * If any constraint has coefficients (except the contant term)
- * with a common factor "f", then we can replace the constant term "c"
- * by
- *
- * f * floor(c/f)
- *
- * That is, we add
- *
- * f * floor(c/f) - c = -fract(c/f)
- *
- * and we can add the same value to the original constraint.
- *
- * In the example, the compressed space only contains "j",
- * and the inequality translates to
- *
- * 3 * j - 1 >= 0
- *
- * We add -fract(-1/3) = -2 to the original constraint to obtain
- *
- * i - 3 >= 0
- */
-static struct isl_basic_set *normalize_constraints_in_compressed_space(
- struct isl_basic_set *bset)
-{
- int i;
- unsigned total;
- struct isl_mat *B, *C;
- isl_int gcd;
-
- if (!bset)
- return NULL;
-
- if (ISL_F_ISSET(bset, ISL_BASIC_SET_RATIONAL))
- return bset;
-
- if (!bset->n_ineq)
- return bset;
-
- bset = isl_basic_set_cow(bset);
- if (!bset)
- return NULL;
-
- total = isl_basic_set_total_dim(bset);
- B = isl_mat_sub_alloc(bset->ctx, bset->eq, 0, bset->n_eq, 0, 1 + total);
- C = isl_mat_variable_compression(B, NULL);
- if (!C)
- return bset;
- if (C->n_col == 0) {
- isl_mat_free(C);
- return isl_basic_set_set_to_empty(bset);
- }
- B = isl_mat_sub_alloc(bset->ctx, bset->ineq,
- 0, bset->n_ineq, 0, 1 + total);
- C = isl_mat_product(B, C);
- if (!C)
- return bset;
-
- isl_int_init(gcd);
- for (i = 0; i < bset->n_ineq; ++i) {
- isl_seq_gcd(C->row[i] + 1, C->n_col - 1, &gcd);
- if (isl_int_is_one(gcd))
- continue;
- isl_int_fdiv_r(C->row[i][0], C->row[i][0], gcd);
- isl_int_sub(bset->ineq[i][0], bset->ineq[i][0], C->row[i][0]);
- }
- isl_int_clear(gcd);
-
- isl_mat_free(C);
-
- return bset;
-}
-
/* Remove all information from bset that is redundant in the context
* of context. Both bset and context are assumed to be full-dimensional.
*
* We first compute the integer affine hull of the intersection,
* compute the gist inside this affine hull and then add back
* those equalities that are not implied by the context.
+ *
+ * If two constraints are mutually redundant, then uset_gist_full
+ * will remove the second of those constraints. We therefore first
+ * sort the constraints so that constraints not involving existentially
+ * quantified variables are given precedence over those that do.
+ * We have to perform this sorting before the variable compression,
+ * because that may effect the order of the variables.
*/
static __isl_give isl_basic_set *uset_gist(__isl_take isl_basic_set *bset,
__isl_take isl_basic_set *context)
goto error;
bset = isl_basic_set_intersect(bset, isl_basic_set_copy(context));
- if (isl_basic_set_fast_is_empty(bset)) {
+ if (isl_basic_set_plain_is_empty(bset)) {
isl_basic_set_free(context);
return bset;
}
+ bset = isl_basic_set_sort_constraints(bset);
aff = isl_basic_set_affine_hull(isl_basic_set_copy(bset));
if (!aff)
goto error;
- if (isl_basic_set_fast_is_empty(aff)) {
+ if (isl_basic_set_plain_is_empty(aff)) {
isl_basic_set_free(aff);
isl_basic_set_free(context);
return bset;
return uset_gist_full(bset, context);
}
total = isl_basic_set_total_dim(bset);
- eq = isl_mat_sub_alloc(bset->ctx, aff->eq, 0, aff->n_eq, 0, 1 + total);
+ eq = isl_mat_sub_alloc6(bset->ctx, aff->eq, 0, aff->n_eq, 0, 1 + total);
eq = isl_mat_cow(eq);
T = isl_mat_variable_compression(eq, &T2);
if (T && T->n_col == 0) {
if (!bmap || !context)
goto error;
- if (isl_basic_map_is_universe(context)) {
- isl_basic_map_free(context);
- return bmap;
- }
if (isl_basic_map_is_universe(bmap)) {
isl_basic_map_free(context);
return bmap;
}
- if (isl_basic_map_fast_is_empty(context)) {
- struct isl_dim *dim = isl_dim_copy(bmap->dim);
+ if (isl_basic_map_plain_is_empty(context)) {
+ isl_space *dim = isl_space_copy(bmap->dim);
isl_basic_map_free(context);
isl_basic_map_free(bmap);
return isl_basic_map_universe(dim);
}
- if (isl_basic_map_fast_is_empty(bmap)) {
+ if (isl_basic_map_plain_is_empty(bmap)) {
isl_basic_map_free(context);
return bmap;
}
- bmap = isl_basic_map_convex_hull(bmap);
- context = isl_basic_map_convex_hull(context);
+ bmap = isl_basic_map_remove_redundancies(bmap);
+ context = isl_basic_map_remove_redundancies(context);
if (context->n_eq)
bmap = normalize_divs_in_context(bmap, context);
if (!map || !context)
goto error;;
- if (isl_basic_map_is_universe(context)) {
- isl_basic_map_free(context);
- return map;
- }
- if (isl_basic_map_fast_is_empty(context)) {
- struct isl_dim *dim = isl_dim_copy(map->dim);
+ if (isl_basic_map_plain_is_empty(context)) {
+ isl_space *dim = isl_space_copy(map->dim);
isl_basic_map_free(context);
isl_map_free(map);
return isl_map_universe(dim);
}
- context = isl_basic_map_convex_hull(context);
+ context = isl_basic_map_remove_redundancies(context);
map = isl_map_cow(map);
if (!map || !context)
goto error;;
- isl_assert(map->ctx, isl_dim_equal(map->dim, context->dim), goto error);
+ isl_assert(map->ctx, isl_space_is_equal(map->dim, context->dim), goto error);
map = isl_map_compute_divs(map);
for (i = 0; i < map->n; ++i)
context = isl_basic_map_align_divs(context, map->p[i]);
- for (i = 0; i < map->n; ++i) {
+ for (i = map->n - 1; i >= 0; --i) {
map->p[i] = isl_basic_map_gist(map->p[i],
isl_basic_map_copy(context));
if (!map->p[i])
goto error;
+ if (isl_basic_map_plain_is_empty(map->p[i])) {
+ isl_basic_map_free(map->p[i]);
+ if (i != map->n - 1)
+ map->p[i] = map->p[map->n - 1];
+ map->n--;
+ }
}
isl_basic_map_free(context);
ISL_F_CLR(map, ISL_MAP_NORMALIZED);
return NULL;
}
+static __isl_give isl_map *map_gist(__isl_take isl_map *map,
+ __isl_take isl_map *context)
+{
+ context = isl_map_compute_divs(context);
+ return isl_map_gist_basic_map(map, isl_map_simple_hull(context));
+}
+
__isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
__isl_take isl_map *context)
{
- return isl_map_gist_basic_map(map, isl_map_convex_hull(context));
+ return isl_map_align_params_map_map_and(map, context, &map_gist);
}
struct isl_basic_set *isl_basic_set_gist(struct isl_basic_set *bset,
* one basic map in the context of the equalities of the other
* basic map and check if we get a contradiction.
*/
-int isl_basic_map_fast_is_disjoint(struct isl_basic_map *bmap1,
- struct isl_basic_map *bmap2)
+int isl_basic_map_plain_is_disjoint(__isl_keep isl_basic_map *bmap1,
+ __isl_keep isl_basic_map *bmap2)
{
struct isl_vec *v = NULL;
int *elim = NULL;
if (!bmap1 || !bmap2)
return -1;
- isl_assert(bmap1->ctx, isl_dim_equal(bmap1->dim, bmap2->dim),
+ isl_assert(bmap1->ctx, isl_space_is_equal(bmap1->dim, bmap2->dim),
return -1);
if (bmap1->n_div || bmap2->n_div)
return 0;
if (!bmap1->n_eq && !bmap2->n_eq)
return 0;
- total = isl_dim_total(bmap1->dim);
+ total = isl_space_dim(bmap1->dim, isl_dim_all);
if (total == 0)
return 0;
v = isl_vec_alloc(bmap1->ctx, 1 + total);
return -1;
}
-int isl_basic_set_fast_is_disjoint(struct isl_basic_set *bset1,
- struct isl_basic_set *bset2)
+int isl_basic_set_plain_is_disjoint(__isl_keep isl_basic_set *bset1,
+ __isl_keep isl_basic_set *bset2)
{
- return isl_basic_map_fast_is_disjoint((struct isl_basic_map *)bset1,
+ return isl_basic_map_plain_is_disjoint((struct isl_basic_map *)bset1,
(struct isl_basic_map *)bset2);
}
-int isl_map_fast_is_disjoint(struct isl_map *map1, struct isl_map *map2)
+int isl_map_plain_is_disjoint(__isl_keep isl_map *map1,
+ __isl_keep isl_map *map2)
{
int i, j;
if (!map1 || !map2)
return -1;
- if (isl_map_fast_is_equal(map1, map2))
+ if (isl_map_plain_is_equal(map1, map2))
return 0;
for (i = 0; i < map1->n; ++i) {
for (j = 0; j < map2->n; ++j) {
- int d = isl_basic_map_fast_is_disjoint(map1->p[i],
+ int d = isl_basic_map_plain_is_disjoint(map1->p[i],
map2->p[j]);
if (d != 1)
return d;
return 1;
}
-int isl_set_fast_is_disjoint(struct isl_set *set1, struct isl_set *set2)
+int isl_set_plain_is_disjoint(__isl_keep isl_set *set1,
+ __isl_keep isl_set *set2)
{
- return isl_map_fast_is_disjoint((struct isl_map *)set1,
+ return isl_map_plain_is_disjoint((struct isl_map *)set1,
(struct isl_map *)set2);
}
+int isl_set_fast_is_disjoint(__isl_keep isl_set *set1, __isl_keep isl_set *set2)
+{
+ return isl_set_plain_is_disjoint(set1, set2);
+}
+
/* Check if we can combine a given div with lower bound l and upper
* bound u with some other div and if so return that other div.
* Otherwise return -1.
if (bmap->n_div <= 1)
return -1;
- dim = isl_dim_total(bmap->dim);
+ dim = isl_space_dim(bmap->dim, isl_dim_all);
if (isl_seq_first_non_zero(bmap->ineq[l] + 1 + dim, div) != -1)
return -1;
if (isl_seq_first_non_zero(bmap->ineq[l] + 1 + dim + div + 1,
int l, int u, isl_int *ineq, isl_int g, isl_int fl, isl_int fu)
{
unsigned dim;
- dim = isl_dim_total(bmap->dim);
+ dim = isl_space_dim(bmap->dim, isl_dim_all);
isl_int_gcd(g, bmap->ineq[l][1 + dim + i], bmap->ineq[u][1 + dim + i]);
isl_int_divexact(fl, bmap->ineq[l][1 + dim + i], g);
if (!bmap)
goto error;
- dim = isl_dim_total(bmap->dim);
+ dim = isl_space_dim(bmap->dim, isl_dim_all);
vec = isl_vec_alloc(bmap->ctx, 1 + dim + bmap->n_div);
if (!vec)
goto error;
if (remove < 0)
return bmap;
- bmap = isl_basic_map_remove(bmap, isl_dim_div, remove, 1);
+ bmap = isl_basic_map_remove_dims(bmap, isl_dim_div, remove, 1);
return isl_basic_map_drop_redundant_divs(bmap);
error:
free(pairs);
unsigned dim, total;
int i;
- dim = isl_dim_total(bmap->dim);
+ dim = isl_space_dim(bmap->dim, isl_dim_all);
total = 1 + dim + bmap->n_div;
isl_int_init(a);
int i, l, u;
unsigned dim;
- dim = isl_dim_total(bmap->dim);
+ dim = isl_space_dim(bmap->dim, isl_dim_all);
for (i = 0; i < bmap->n_div; ++i) {
if (!pairs[i])
if (!bmap)
goto error;
- off = isl_dim_total(bmap->dim);
+ off = isl_space_dim(bmap->dim, isl_dim_all);
pairs = isl_calloc_array(bmap->ctx, int, bmap->n_div);
if (!pairs)
goto error;