struct isl_basic_map *isl_map_affine_hull(struct isl_map *map) { int i; struct isl_basic_map *model = NULL; struct isl_basic_map *hull = NULL; struct isl_set *set; map = isl_map_detect_equalities(map); map = isl_map_align_divs(map); if (!map) return NULL; if (map->n == 0) { hull = isl_basic_map_empty_like_map(map); isl_map_free(map); return hull; } model = isl_basic_map_copy(map->p[0]); set = isl_map_underlying_set(map); set = isl_set_cow(set); if (!set) goto error; for (i = 0; i < set->n; ++i) { set->p[i] = isl_basic_set_cow(set->p[i]); set->p[i] = isl_basic_set_affine_hull(set->p[i]); set->p[i] = isl_basic_set_gauss(set->p[i], NULL); if (!set->p[i]) goto error; } set = isl_set_remove_empty_parts(set); if (set->n == 0) { hull = isl_basic_map_empty_like(model); isl_basic_map_free(model); } else { struct isl_basic_set *bset; while (set->n > 1) { set->p[0] = affine_hull(set->p[0], set->p[--set->n]); if (!set->p[0]) goto error; } bset = isl_basic_set_copy(set->p[0]); hull = isl_basic_map_overlying_set(bset, model); } isl_set_free(set); hull = isl_basic_map_simplify(hull); return isl_basic_map_finalize(hull); error: isl_basic_map_free(model); isl_set_free(set); return NULL; }
struct isl_basic_map *isl_basic_map_implicit_equalities( struct isl_basic_map *bmap) { struct isl_tab *tab; if (!bmap) return bmap; bmap = isl_basic_map_gauss(bmap, NULL); if (ISL_F_ISSET(bmap, ISL_BASIC_MAP_EMPTY)) return bmap; if (ISL_F_ISSET(bmap, ISL_BASIC_MAP_NO_IMPLICIT)) return bmap; if (bmap->n_ineq <= 1) return bmap; tab = isl_tab_from_basic_map(bmap); if (isl_tab_detect_implicit_equalities(tab) < 0) goto error; bmap = isl_basic_map_update_from_tab(bmap, tab); isl_tab_free(tab); bmap = isl_basic_map_gauss(bmap, NULL); ISL_F_SET(bmap, ISL_BASIC_MAP_NO_IMPLICIT); return bmap; error: isl_tab_free(tab); isl_basic_map_free(bmap); return NULL; }
struct isl_map *isl_pip_basic_map_lexopt( struct isl_basic_map *bmap, struct isl_basic_set *dom, struct isl_set **empty, int max) { isl_basic_map_free(bmap); isl_basic_set_free(dom); return NULL; }
/// Add an isl basic map to a ScopLib matrix_list /// /// @param bmap The basic map to add /// @param user The matrix list we should add the basic map to /// /// XXX: At the moment this function expects just a matrix, as support /// for matrix lists is currently not available in ScopLib. So union of /// polyhedron are not yet supported int ScopLib::scatteringToMatrix_basic_map(isl_basic_map *bmap, void *user) { scoplib_matrix_p m = (scoplib_matrix_p) user; assert(!m->NbRows && "Union of polyhedron not yet supported"); isl_basic_map_foreach_constraint(bmap, &scatteringToMatrix_constraint, user); isl_basic_map_free(bmap); return 0; }
/* Detect and make explicit all equalities satisfied by the (integer) * points in bmap. */ struct isl_basic_map *isl_basic_map_detect_equalities( struct isl_basic_map *bmap) { int i, j; struct isl_basic_set *hull = NULL; if (!bmap) return NULL; if (bmap->n_ineq == 0) return bmap; if (ISL_F_ISSET(bmap, ISL_BASIC_MAP_EMPTY)) return bmap; if (ISL_F_ISSET(bmap, ISL_BASIC_MAP_ALL_EQUALITIES)) return bmap; if (ISL_F_ISSET(bmap, ISL_BASIC_MAP_RATIONAL)) return isl_basic_map_implicit_equalities(bmap); hull = equalities_in_underlying_set(isl_basic_map_copy(bmap)); if (!hull) goto error; if (ISL_F_ISSET(hull, ISL_BASIC_SET_EMPTY)) { isl_basic_set_free(hull); return isl_basic_map_set_to_empty(bmap); } bmap = isl_basic_map_extend_dim(bmap, isl_dim_copy(bmap->dim), 0, hull->n_eq, 0); for (i = 0; i < hull->n_eq; ++i) { j = isl_basic_map_alloc_equality(bmap); if (j < 0) goto error; isl_seq_cpy(bmap->eq[j], hull->eq[i], 1 + isl_basic_set_total_dim(hull)); } isl_vec_free(bmap->sample); bmap->sample = isl_vec_copy(hull->sample); isl_basic_set_free(hull); ISL_F_SET(bmap, ISL_BASIC_MAP_NO_IMPLICIT | ISL_BASIC_MAP_ALL_EQUALITIES); bmap = isl_basic_map_simplify(bmap); return isl_basic_map_finalize(bmap); error: isl_basic_set_free(hull); isl_basic_map_free(bmap); return NULL; }
__isl_give isl_map *isl_map_inline_foreach_basic_map(__isl_take isl_map *map, __isl_give isl_basic_map *(*fn)(__isl_take isl_basic_map *bmap)) { struct isl_basic_map *bmap; int i; if (!map) return NULL; for (i = 0; i < map->n; ++i) { bmap = isl_basic_map_copy(map->p[i]); bmap = fn(bmap); if (!bmap) goto error; isl_basic_map_free(map->p[i]); map->p[i] = bmap; } return map; error: isl_map_free(map); return NULL; }
/// Add an isl basic map to a ScopLib matrix_list /// /// @param bmap The basic map to add /// @param user The matrix list we should add the basic map to /// /// XXX: At the moment this function expects just a matrix, as support /// for matrix lists is currently not available in ScopLib. So union of /// polyhedron are not yet supported int ScopLib::accessToMatrix_basic_map(isl_basic_map *bmap, void *user) { isl_basic_map_foreach_constraint(bmap, &accessToMatrix_constraint, user); isl_basic_map_free(bmap); return 0; }