from .islhelper import mainctx, libisl
from .geometry import GeometricObject, Point
-from .linexprs import Expression, Rational
+from .linexprs import LinExpr, Rational
from .domains import Domain
"""
Create and return a new Polyhedron from a string or list of equalities and inequalities.
"""
-
+
if isinstance(equalities, str):
if inequalities is not None:
raise TypeError('too many arguments')
equalities = []
else:
for i, equality in enumerate(equalities):
- if not isinstance(equality, Expression):
+ if not isinstance(equality, LinExpr):
raise TypeError('equalities must be linear expressions')
equalities[i] = equality.scaleint()
if inequalities is None:
inequalities = []
else:
for i, inequality in enumerate(inequalities):
- if not isinstance(inequality, Expression):
+ if not isinstance(inequality, LinExpr):
raise TypeError('inequalities must be linear expressions')
inequalities[i] = inequality.scaleint()
symbols = cls._xsymbols(equalities + inequalities)
coefficient = islhelper.isl_val_to_int(coefficient)
if coefficient != 0:
coefficients[symbol] = coefficient
- expression = Expression(coefficients, constant)
+ expression = LinExpr(coefficients, constant)
if libisl.isl_constraint_is_equality(islconstraint):
equalities.append(expression)
else:
def _polymorphic(func):
@functools.wraps(func)
def wrapper(left, right):
- if not isinstance(left, Expression):
+ if not isinstance(left, LinExpr):
if isinstance(left, numbers.Rational):
left = Rational(left)
else:
raise TypeError('left must be a a rational number '
'or a linear expression')
- if not isinstance(right, Expression):
+ if not isinstance(right, LinExpr):
if isinstance(right, numbers.Rational):
right = Rational(right)
else: