Add methods Domain.subs(), Polyhedron.subs()
[linpy.git] / pypol / domains.py
index fdb0ab0..2fbd544 100644 (file)
@@ -301,6 +301,11 @@ class Domain:
             points.append(point)
         return points
 
             points.append(point)
         return points
 
+    def subs(self, symbol, expression=None):
+        polyhedra = [polyhedron.subs(symbol, expression)
+            for polyhedron in self.polyhedra]
+        return Domain(*polyhedra)
+
     @classmethod
     def _fromislset(cls, islset, symbols):
         from .polyhedra import Polyhedron
     @classmethod
     def _fromislset(cls, islset, symbols):
         from .polyhedra import Polyhedron
@@ -323,6 +328,7 @@ class Domain:
             self._dimension = len(self._symbols)
             return self
 
             self._dimension = len(self._symbols)
             return self
 
+    @classmethod
     def _toislset(cls, polyhedra, symbols):
         polyhedron = polyhedra[0]
         islbset = polyhedron._toislbasicset(polyhedron.equalities,
     def _toislset(cls, polyhedra, symbols):
         polyhedron = polyhedra[0]
         islbset = polyhedron._toislbasicset(polyhedron.equalities,