Cleaner and faster linear expressions
[linpy.git] / pypol / polyhedra.py
index ac67cf8..6ef7cc1 100644 (file)
@@ -44,14 +44,14 @@ class Polyhedron(Domain):
             for i, equality in enumerate(equalities):
                 if not isinstance(equality, Expression):
                     raise TypeError('equalities must be linear expressions')
-                equalities[i] = equality._toint()
+                equalities[i] = equality.scaleint()
         if inequalities is None:
             inequalities = []
         else:
             for i, inequality in enumerate(inequalities):
                 if not isinstance(inequality, Expression):
                     raise TypeError('inequalities must be linear expressions')
-                inequalities[i] = inequality._toint()
+                inequalities[i] = inequality.scaleint()
         symbols = cls._xsymbols(equalities + inequalities)
         islbset = cls._toislbasicset(equalities, inequalities, symbols)
         return cls._fromislbasicset(islbset, symbols)
@@ -95,7 +95,8 @@ class Polyhedron(Domain):
             constant = islhelper.isl_val_to_int(constant)
             coefficients = {}
             for index, symbol in enumerate(symbols):
-                coefficient = libisl.isl_constraint_get_coefficient_val(islconstraint, libisl.isl_dim_set, index)
+                coefficient = libisl.isl_constraint_get_coefficient_val(islconstraint,
+                    libisl.isl_dim_set, index)
                 coefficient = islhelper.isl_val_to_int(coefficient)
                 if coefficient != 0:
                     coefficients[symbol] = coefficient