pyzx
pyzx copied to clipboard
`full_reduce` scalar edge case
These examples are ran on the version of pyzx on pip:
In this example the right thing happens and we get (1 + 1j)
from pyzx import Graph, full_reduce
g = Graph()
g.add_vertex(ty=1, phase=0.5)
g.add_vertex(ty=1, phase=0)
g.add_edge((0, 1))
full_reduce(g)
print(g.scalar.to_number())
but in this example full_reduce
does not reduce the diagram fully and the scalar is still 1:
from pyzx import Graph, full_reduce
g = Graph()
g.add_vertex(ty=1, phase=1)
full_reduce(g)
print(g.scalar.to_number())
This could be intended behaviour, but what is the "correct" way to reduce a pyzx diagram to a scalar?