* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
*/
+#include <isl_map_private.h>
#include <isl/seq.h>
#include <isl/set.h>
#include <isl/map.h>
-#include "isl_map_private.h"
#include "isl_tab.h"
#include <isl_point_private.h>
tab_total = isl_basic_map_total_dim(tab->bmap);
bmap_total = isl_basic_map_total_dim(bmap);
- dim = isl_dim_total(tab->bmap->dim);
+ dim = isl_space_dim(tab->bmap->dim, isl_dim_all);
if (isl_tab_extend_cons(tab, 2 * bmap->n_eq + bmap->n_ineq) < 0)
return -1;
tab_total = isl_basic_map_total_dim(tab->bmap);
bmap_total = isl_basic_map_total_dim(bmap);
- dim = isl_dim_total(tab->bmap->dim);
+ dim = isl_space_dim(tab->bmap->dim, isl_dim_all);
v = isl_vec_alloc(bmap->ctx, 1 + tab_total);
if (!v)
* Put the indices of the redundant constraints in index
* and return the number of redundant constraints.
*/
-static int n_non_redundant(struct isl_tab *tab, int offset, int **index)
+static int n_non_redundant(isl_ctx *ctx, struct isl_tab *tab,
+ int offset, int **index)
{
int i, n;
int n_test = tab->n_con - offset;
return -1;
if (!*index)
- *index = isl_alloc_array(tab->mat->ctx, int, n_test);
+ *index = isl_alloc_array(ctx, int, n_test);
if (!*index)
return -1;
int level;
int init;
int empty;
+ isl_ctx *ctx;
struct isl_tab *tab = NULL;
struct isl_tab_undo **snap = NULL;
int *k = NULL;
if (!bmap || !map)
goto error;
+ ctx = map->ctx;
snap = isl_alloc_array(map->ctx, struct isl_tab_undo *, map->n);
k = isl_alloc_array(map->ctx, int, map->n);
n = isl_alloc_array(map->ctx, int, map->n);
continue;
}
modified = 1;
- n[level] = n_non_redundant(tab, offset, &index[level]);
+ n[level] = n_non_redundant(ctx, tab, offset,
+ &index[level]);
if (n[level] < 0)
goto error;
if (n[level] == 0) {
/* Return the set difference between map1 and map2.
* (U_i A_i) \ (U_j B_j) is computed as U_i (A_i \ (U_j B_j))
*/
-struct isl_map *isl_map_subtract(struct isl_map *map1, struct isl_map *map2)
+static __isl_give isl_map *map_subtract( __isl_take isl_map *map1,
+ __isl_take isl_map *map2)
{
int i;
struct isl_map *diff;
if (!map1 || !map2)
goto error;
- isl_assert(map1->ctx, isl_dim_equal(map1->dim, map2->dim), goto error);
+ isl_assert(map1->ctx, isl_space_is_equal(map1->dim, map2->dim), goto error);
if (isl_map_is_empty(map2)) {
isl_map_free(map2);
return NULL;
}
+__isl_give isl_map *isl_map_subtract( __isl_take isl_map *map1,
+ __isl_take isl_map *map2)
+{
+ return isl_map_align_params_map_map_and(map1, map2, &map_subtract);
+}
+
struct isl_set *isl_set_subtract(struct isl_set *set1, struct isl_set *set2)
{
return (struct isl_set *)
int r;
struct isl_is_empty_diff_collector edc;
- r = isl_basic_map_fast_is_empty(bmap);
+ r = isl_basic_map_plain_is_empty(bmap);
if (r)
return r;
/* Return 1 if "bmap" contains a single element.
*/
-int isl_basic_map_fast_is_singleton(__isl_keep isl_basic_map *bmap)
+int isl_basic_map_plain_is_singleton(__isl_keep isl_basic_map *bmap)
{
if (!bmap)
return -1;
/* Return 1 if "map" contains a single element.
*/
-int isl_map_fast_is_singleton(__isl_keep isl_map *map)
+int isl_map_plain_is_singleton(__isl_keep isl_map *map)
{
if (!map)
return -1;
if (map->n != 1)
return 0;
- return isl_basic_map_fast_is_singleton(map->p[0]);
+ return isl_basic_map_plain_is_singleton(map->p[0]);
}
/* Given a singleton basic map, extract the single element
static __isl_give isl_point *singleton_extract_point(
__isl_keep isl_basic_map *bmap)
{
- int i, j;
+ int j;
unsigned dim;
struct isl_vec *point;
isl_int m;
isl_int_set_si(point->el[0], 1);
for (j = 0; j < bmap->n_eq; ++j) {
- int s;
int i = dim - 1 - j;
isl_assert(bmap->ctx,
isl_seq_first_non_zero(bmap->eq[j] + 1, i) == -1,
}
isl_int_clear(m);
- return isl_point_alloc(isl_basic_map_get_dim(bmap), point);
+ return isl_point_alloc(isl_basic_map_get_space(bmap), point);
error:
isl_int_clear(m);
isl_vec_free(point);
int isl_map_is_subset(struct isl_map *map1, struct isl_map *map2)
{
int is_subset = 0;
- struct isl_map *diff;
if (!map1 || !map2)
return -1;
+ if (!isl_map_has_equal_space(map1, map2))
+ return 0;
+
if (isl_map_is_empty(map1))
return 1;
if (isl_map_is_empty(map2))
return 0;
- if (isl_map_fast_is_universe(map2))
+ if (isl_map_plain_is_universe(map2))
return 1;
map2 = isl_map_compute_divs(isl_map_copy(map2));
- if (isl_map_fast_is_singleton(map1)) {
+ if (isl_map_plain_is_singleton(map1)) {
is_subset = map_is_singleton_subset(map1, map2);
isl_map_free(map2);
return is_subset;
if (!set)
return NULL;
- universe = isl_set_universe(isl_set_get_dim(set));
+ universe = isl_set_universe(isl_set_get_space(set));
return isl_set_subtract(universe, set);
}