X-Git-Url: https://svn.cri.ensmp.fr/git/linpy.git/blobdiff_plain/114cd46edf08bcf13c5f489c449db98f6098c468..d9ce6feb2d36e40e83326744f1d4ff3890d1874f:/pypol/domains.py?ds=sidebyside diff --git a/pypol/domains.py b/pypol/domains.py index be9dd4b..cdf2de4 100644 --- a/pypol/domains.py +++ b/pypol/domains.py @@ -304,20 +304,13 @@ class Domain(GeometricObject): islset = libisl.isl_set_lexmax(islset) return self._fromislset(islset, self.symbols) - def num_parameters(self): - """ - Return the total number of parameters, input, output or set dimensions. - """ - islbset = self._toislbasicset(self.equalities, self.inequalities, self.symbols) - num = libisl.isl_basic_set_dim(islbset, libisl.isl_dim_set) - return num - def involves_dims(self, dims): + def involves_vars(self, vars): """ - Returns true if set depends on given dimensions. + Returns true if a set depends on given dimensions. """ islset = self._toislset(self.polyhedra, self.symbols) - dims = sorted(dims) + dims = sorted(vars) symbols = sorted(list(self.symbols)) n = 0 if len(dims)>0: @@ -340,6 +333,8 @@ class Domain(GeometricObject): Return a list of vertices for this Polygon. """ from .polyhedra import Polyhedron + if not self.isbounded(): + raise ValueError('domain must be bounded') islbset = self._toislbasicset(self.equalities, self.inequalities, self.symbols) vertices = libisl.isl_basic_set_compute_vertices(islbset); vertices = islhelper.isl_vertices_vertices(vertices) @@ -443,6 +438,9 @@ class Domain(GeometricObject): return sorted(points, key=angles.get) def faces(self): + """ + Returns the vertices of the faces of a polyhedra. + """ faces = [] for polyhedron in self.polyhedra: vertices = polyhedron.vertices() @@ -503,6 +501,7 @@ class Domain(GeometricObject): axes.set_zlim(zmin, zmax) return axes + def plot(self, plot=None, **kwargs): """ Display plot of this set. @@ -523,6 +522,10 @@ class Domain(GeometricObject): return False def subs(self, symbol, expression=None): + """ + Subsitute the given value into an expression and return the resulting + expression. + """ polyhedra = [polyhedron.subs(symbol, expression) for polyhedron in self.polyhedra] return Domain(*polyhedra)