else:
for polyhedron in polyhedra:
if not isinstance(polyhedron, Polyhedron):
else:
for polyhedron in polyhedra:
if not isinstance(polyhedron, Polyhedron):
Return an equivalent domain, whose polyhedra are disjoint.
"""
islset = self._toislset(self.polyhedra, self.symbols)
Return an equivalent domain, whose polyhedra are disjoint.
"""
islset = self._toislset(self.polyhedra, self.symbols)
- islset = libisl.isl_set_project_out(islset,
- libisl.isl_dim_set, index + 1, n)
+ islset = libisl.isl_set_project_out(
+ islset, libisl.isl_dim_set, index + 1, n)
- islset = libisl.isl_set_project_out(islset, libisl.isl_dim_set, 0, n)
+ islset = libisl.isl_set_project_out(
+ islset, libisl.isl_dim_set, 0, n)
symbols = [symbol for symbol in self.symbols if symbol not in symbols]
return Domain._fromislset(islset, symbols)
symbols = [symbol for symbol in self.symbols if symbol not in symbols]
return Domain._fromislset(islset, symbols)
raise ValueError('domain must be non-empty')
point = {}
for index, symbol in enumerate(self.symbols):
raise ValueError('domain must be non-empty')
point = {}
for index, symbol in enumerate(self.symbols):
- coordinate = libisl.isl_point_get_coordinate_val(islpoint,
- libisl.isl_dim_set, index)
+ coordinate = libisl.isl_point_get_coordinate_val(
+ islpoint, libisl.isl_dim_set, index)
coordinate = islhelper.isl_val_to_int(coordinate)
point[symbol] = coordinate
libisl.isl_point_free(islpoint)
coordinate = islhelper.isl_val_to_int(coordinate)
point[symbol] = coordinate
libisl.isl_point_free(islpoint)
if not self.isbounded():
raise ValueError('domain must be bounded')
islbset = self._toislbasicset(self.equalities, self.inequalities,
if not self.isbounded():
raise ValueError('domain must be bounded')
islbset = self._toislbasicset(self.equalities, self.inequalities,
if self._RE_COORDINATE is None:
constraints = islhelper.isl_basic_set_constraints(expression)
for constraint in constraints:
if self._RE_COORDINATE is None:
constraints = islhelper.isl_basic_set_constraints(expression)
for constraint in constraints:
constant = islhelper.isl_val_to_int(constant)
for index, symbol in enumerate(self.symbols):
constant = islhelper.isl_val_to_int(constant)
for index, symbol in enumerate(self.symbols):
- coefficient = libisl.isl_constraint_get_coefficient_val(constraint,
- libisl.isl_dim_set, index)
+ coefficient = \
+ libisl.isl_constraint_get_coefficient_val(
+ constraint, libisl.isl_dim_set, index)
coefficient = islhelper.isl_val_to_int(coefficient)
if coefficient != 0:
coordinate = -Fraction(constant, coefficient)
coefficient = islhelper.isl_val_to_int(coefficient)
if coefficient != 0:
coordinate = -Fraction(constant, coefficient)
for symbol, match in zip(self.symbols, matches):
numerator = int(match.group('num'))
denominator = match.group('den')
for symbol, match in zip(self.symbols, matches):
numerator = int(match.group('num'))
denominator = match.group('den')
coordinate = Fraction(numerator, denominator)
coordinates.append((symbol, coordinate))
points.append(Point(coordinates))
coordinate = Fraction(numerator, denominator)
coordinates.append((symbol, coordinate))
points.append(Point(coordinates))
islset = self._toislset(self.polyhedra, self.symbols)
islpoints = islhelper.isl_set_points(islset)
points = []
for islpoint in islpoints:
coordinates = {}
for index, symbol in enumerate(self.symbols):
islset = self._toislset(self.polyhedra, self.symbols)
islpoints = islhelper.isl_set_points(islset)
points = []
for islpoint in islpoints:
coordinates = {}
for index, symbol in enumerate(self.symbols):
- coordinate = libisl.isl_point_get_coordinate_val(islpoint,
- libisl.isl_dim_set, index)
+ coordinate = libisl.isl_point_get_coordinate_val(
+ islpoint, libisl.isl_dim_set, index)
coordinate = islhelper.isl_val_to_int(coordinate)
coordinates[symbol] = coordinate
points.append(Point(coordinates))
coordinate = islhelper.isl_val_to_int(coordinate)
coordinates[symbol] = coordinate
points.append(Point(coordinates))
elif self.dimension == 3:
return self._plot_3d(plot=plot, **kwargs)
else:
elif self.dimension == 3:
return self._plot_3d(plot=plot, **kwargs)
else:
similar to LinExpr.subs().
"""
polyhedra = [polyhedron.subs(symbol, expression)
similar to LinExpr.subs().
"""
polyhedra = [polyhedron.subs(symbol, expression)
@classmethod
def _toislset(cls, polyhedra, symbols):
polyhedron = polyhedra[0]
@classmethod
def _toislset(cls, polyhedra, symbols):
polyhedron = polyhedra[0]
- islbset = polyhedron._toislbasicset(polyhedron.equalities,
- polyhedron.inequalities, symbols)
+ islbset = polyhedron._toislbasicset(
+ polyhedron.equalities, polyhedron.inequalities, symbols)
- islbset = polyhedron._toislbasicset(polyhedron.equalities,
- polyhedron.inequalities, symbols)
+ islbset = polyhedron._toislbasicset(
+ polyhedron.equalities, polyhedron.inequalities, symbols)
islset2 = libisl.isl_set_from_basic_set(islbset)
islset1 = libisl.isl_set_union(islset1, islset2)
return islset1
islset2 = libisl.isl_set_from_basic_set(islbset)
islset1 = libisl.isl_set_union(islset1, islset2)
return islset1