from . import islhelper
from .islhelper import mainctx, libisl
-from .linexprs import Expression, Constant
+from .linexprs import Expression, Rational
from .domains import 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)
equalities = []
inequalities = []
for islconstraint in islconstraints:
- islpr = libisl.isl_printer_to_str(mainctx)
constant = libisl.isl_constraint_get_constant_val(islconstraint)
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
@functools.wraps(func)
def wrapper(left, right):
if isinstance(left, numbers.Rational):
- left = Constant(left)
+ left = Rational(left)
elif not isinstance(left, Expression):
raise TypeError('left must be a a rational number '
'or a linear expression')
if isinstance(right, numbers.Rational):
- right = Constant(right)
+ right = Rational(right)
elif not isinstance(right, Expression):
raise TypeError('right must be a a rational number '
'or a linear expression')