Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

circuits equal up to global phase #143

Open
punkdit opened this issue Sep 1, 2023 · 5 comments
Open

circuits equal up to global phase #143

punkdit opened this issue Sep 1, 2023 · 5 comments

Comments

@punkdit
Copy link

punkdit commented Sep 1, 2023

c0 = zx.Circuit(1)
c0.add_gate("NOT", 0)
c0.add_gate("Z", 0)

c1 = zx.Circuit(1)
c1.add_gate("Z", 0)
c1.add_gate("NOT", 0)
print(c0.verify_equality(c1))

It should be made clear in the documentation that verify_equality is equality of circuits up to global phase only. Or have I done something wrong?

See also: https://quantumcomputing.stackexchange.com/a/25789

@jvdwetering
Copy link
Collaborator

Yes, that's right, this only verifies equality up to global phase.
It wouldn't be too hard to add support for testing exact equality here. Would that be useful for your use-case?

@punkdit
Copy link
Author

punkdit commented Sep 1, 2023

Thankyou John. The use case is to generate and/or compute efficiently products and equality within the Clifford group. (The tablaux methods can only do this up to global phase.) As mentioned in the stackexchange question, one idea is to compute with normal forms of ZX diagrams that represent these Clifford elements. How would I do this with PyZX ?

@jvdwetering
Copy link
Collaborator

Do you want to work with states or with unitaries? And do the normal forms have to be unique? It is possible to get a unique normal form for states using ZX, but this is currently not implemented in PyZX. To do that you would use the algorithm described in https://arxiv.org/abs/2306.05204 but adapted again to qubits.

@punkdit
Copy link
Author

punkdit commented Sep 1, 2023

I'm interested in the Clifford group: these are unitary operators, but they should have efficient (in qubit number) representations. It sounds like you are telling me this is an open problem. And there needs to be a unique normal form for equality testing.

@jvdwetering
Copy link
Collaborator

The unique normal form for states will also give you a unique normal form for unitaries, by Choi-Jamiolkowski isomorphism (bending wires from being inputs to outputs and vice versa). However, the ZX-diagram you will get out of this is then not super straightforwardly relatable to a circuit decomposition. You can however then still do this using the functions built into pyzx, it's just not straightforward to see manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants