8 def __new__(cls
, polyhedron
, range_symbols
, domain_symbols
):
9 self
= object().__new
__(cls
)
10 self
.polyhedron
= polyhedron
11 self
.range_symbols
= range_symbols
12 self
.domain_symbols
= domain_symbols
17 return self
.range_symbols
+ self
.domain_symbols
20 delta_symbols
= [symbol
.asdummy() for symbol
in self
.range_symbols
]
22 polyhedron
= self
.polyhedron
23 for x
, xprime
, dx
in zip(self
.range_symbols
, self
.domain_symbols
, delta_symbols
):
24 polyhedron
&= Eq(dx
, xprime
- x
)
25 polyhedron
= polyhedron
.project_out(self
.symbols
)
26 equalities
, inequalities
= [], []
27 for equality
in polyhedron
.equalities
:
28 equality
+= (k
-1) * equality
.constant
29 equalities
.append(equality
)
30 for inequality
in polyhedron
.inequalities
:
31 inequality
+= (k
-1) * inequality
.constant
32 inequalities
.append(inequality
)
33 polyhedron
= Polyhedron(equalities
, inequalities
) & Ge(k
, 0)
34 polyhedron
= polyhedron
.project_out([k
])
35 for x
, xprime
, dx
in zip(self
.range_symbols
, self
.domain_symbols
, delta_symbols
):
36 polyhedron
&= Eq(dx
, xprime
- x
)
37 polyhedron
= polyhedron
.project_out(delta_symbols
)
38 return Transformer(polyhedron
, self
.range_symbols
, self
.domain_symbols
)
41 if __name__
== '__main__':
42 i
, iprime
, j
, jprime
= symbols("i i' j j'")
43 transformer
= Transformer(Eq(iprime
, i
+ 2) & Eq(jprime
, j
+ 1),
44 [i
, j
], [iprime
, jprime
])
45 print('T =', transformer
.polyhedron
)
46 print('T* =', transformer
.star().polyhedron
)