X-Git-Url: https://svn.cri.ensmp.fr/git/linpy.git/blobdiff_plain/7941e9e70af9f90f2fce0fd3ea694fc0b422f583..c774b95a5e3c664d7adaeac83aace2b045d38a9f:/pypol/domains.py diff --git a/pypol/domains.py b/pypol/domains.py index 9bb403e..4a1f9aa 100644 --- a/pypol/domains.py +++ b/pypol/domains.py @@ -138,10 +138,11 @@ class Domain: return self.complement() def simplify(self): - # see isl_set_coalesce, isl_set_detect_equalities, - # isl_set_remove_redundancies - # which ones? in which order? - raise NotImplementedError + #does not change anything in any of the examples + #isl seems to do this naturally + islset = self._toislset(self.polyhedra, self.symbols) + islset = libisl.isl_set_remove_redundancies(islset) + return self._fromislset(islset, self.symbols) def polyhedral_hull(self): # several types of hull are available @@ -151,11 +152,18 @@ class Domain: islbset = libisl.isl_set_polyhedral_hull(islset) return Polyhedron._fromislbasicset(islbset, self.symbols) - def project(self, symbols): - # not sure what isl_set_project_out actually does… - # use isl_set_drop_constraints_involving_dims instead? - raise NotImplementedError - + def drop_dims(self, dims): + # use to remove certain variables use isl_set_drop_constraints_involving_dims instead? + from .polyhedra import Polyhedron + dims = list(dims) + symbols = list(self.symbols) + islset = self._toislset(self.polyhedra, self.symbols) + for dim in dims: + if dim in symbols: + num = symbols.index(dim) + islbset = libisl.isl_set_drop_constraints_involving_dims(islset, libisl.isl_dim_set, num, 1) + return Polyhedron._fromislset(islbset, self.symbols) + def sample(self): from .polyhedra import Polyhedron islset = self._toislset(self.polyhedra, self.symbols) @@ -329,7 +337,6 @@ class Domain: def tosympy(self): raise NotImplementedError - def And(*domains): if len(domains) == 0: from .polyhedra import Universe