projects
/
linpy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix error message
[linpy.git]
/
examples
/
nsad2010.py
diff --git
a/examples/nsad2010.py
b/examples/nsad2010.py
index
4b73eef
..
3de2ebd
100755
(executable)
--- a/
examples/nsad2010.py
+++ b/
examples/nsad2010.py
@@
-8,7
+8,7
@@
# to compute the transitive closure of an affine transformer. A refined version
# of this algorithm is implemented in PIPS.
# to compute the transitive closure of an affine transformer. A refined version
# of this algorithm is implemented in PIPS.
-from linpy import
*
+from linpy import
Dummy, Eq, Ge, Polyhedron, symbols
class Transformer:
class Transformer:
@@
-28,7
+28,8
@@
class Transformer:
delta_symbols = [symbol.asdummy() for symbol in self.range_symbols]
k = Dummy('k')
polyhedron = self.polyhedron
delta_symbols = [symbol.asdummy() for symbol in self.range_symbols]
k = Dummy('k')
polyhedron = self.polyhedron
- for x, xprime, dx in zip(self.range_symbols, self.domain_symbols, delta_symbols):
+ for x, xprime, dx in zip(
+ self.range_symbols, self.domain_symbols, delta_symbols):
polyhedron &= Eq(dx, xprime - x)
polyhedron = polyhedron.project(self.symbols)
equalities, inequalities = [], []
polyhedron &= Eq(dx, xprime - x)
polyhedron = polyhedron.project(self.symbols)
equalities, inequalities = [], []
@@
-40,7
+41,8
@@
class Transformer:
inequalities.append(inequality)
polyhedron = Polyhedron(equalities, inequalities) & Ge(k, 0)
polyhedron = polyhedron.project([k])
inequalities.append(inequality)
polyhedron = Polyhedron(equalities, inequalities) & Ge(k, 0)
polyhedron = polyhedron.project([k])
- for x, xprime, dx in zip(self.range_symbols, self.domain_symbols, delta_symbols):
+ for x, xprime, dx in zip(
+ self.range_symbols, self.domain_symbols, delta_symbols):
polyhedron &= Eq(dx, xprime - x)
polyhedron = polyhedron.project(delta_symbols)
return Transformer(polyhedron, self.range_symbols, self.domain_symbols)
polyhedron &= Eq(dx, xprime - x)
polyhedron = polyhedron.project(delta_symbols)
return Transformer(polyhedron, self.range_symbols, self.domain_symbols)
@@
-49,6
+51,6
@@
class Transformer:
if __name__ == '__main__':
i0, i, j0, j = symbols('i0 i j0 j')
transformer = Transformer(Eq(i, i0 + 2) & Eq(j, j0 + 1),
if __name__ == '__main__':
i0, i, j0, j = symbols('i0 i j0 j')
transformer = Transformer(Eq(i, i0 + 2) & Eq(j, j0 + 1),
- [i0, j0], [i, j])
+
[i0, j0], [i, j])
print('T =', transformer.polyhedron)
print('T* =', transformer.star().polyhedron)
print('T =', transformer.polyhedron)
print('T* =', transformer.star().polyhedron)