static struct isl_mat *isl_basic_set_samples(struct isl_basic_set *bset) { struct isl_mat *T; struct isl_mat *samples; if (!bset) return NULL; if (bset->n_eq == 0) return isl_basic_set_scan_samples(bset); bset = isl_basic_set_remove_equalities(bset, &T, NULL); samples = isl_basic_set_scan_samples(bset); return isl_mat_product(samples, isl_mat_transpose(T)); }
/* Look for all equalities satisfied by the integer points in bmap * that are independent of the equalities already explicitly available * in bmap. * * We first remove all equalities already explicitly available, * then look for additional equalities in the reduced space * and then transform the result to the original space. * The original equalities are _not_ added to this set. This is * the responsibility of the calling function. * The resulting basic set has all meaning about the dimensions removed. * In particular, dimensions that correspond to existential variables * in bmap and that are found to be fixed are not removed. */ static struct isl_basic_set *equalities_in_underlying_set( struct isl_basic_map *bmap) { struct isl_mat *T1 = NULL; struct isl_mat *T2 = NULL; struct isl_basic_set *bset = NULL; struct isl_basic_set *hull = NULL; bset = isl_basic_map_underlying_set(bmap); if (!bset) return NULL; if (bset->n_eq) bset = isl_basic_set_remove_equalities(bset, &T1, &T2); if (!bset) goto error; hull = uset_affine_hull(bset); if (!T2) return hull; if (!hull) { isl_mat_free(T1); isl_mat_free(T2); } else { struct isl_vec *sample = isl_vec_copy(hull->sample); if (sample && sample->size > 0) sample = isl_mat_vec_product(T1, sample); else isl_mat_free(T1); hull = isl_basic_set_preimage(hull, T2); if (hull) { isl_vec_free(hull->sample); hull->sample = sample; } else isl_vec_free(sample); } return hull; error: isl_mat_free(T2); isl_basic_set_free(bset); isl_basic_set_free(hull); return NULL; }