zxcalc / pyzx

Python library for quantum circuit rewriting and optimisation using the ZX-calculus
Apache License 2.0
365 stars 108 forks source link

Question about Quipper parser #26

Closed khieta closed 4 years ago

khieta commented 4 years ago

Hi, I'm wondering what the factor of 2 is for on line 64 of pyzx/circuit/quipperparser.py. Is this due to a difference between quipper & PyZX's representation of phase gates?

For example, I expected the first rotation in QFT8 to be translated as -PI/8, but the produced translation is -PI/4. Am I interpreting the gates wrong? I just want to make sure I'm translating files correctly. Thanks!

jvdwetering commented 4 years ago

It's been a while, but if I'm not mistaken this is because Quipper represents a Z(theta) rotation as a diag(theta,-theta) gate, while a phase gate in the ZX-calculus is diag(1,theta). Hence the conversion factor.

jvdwetering commented 4 years ago

Did this answer your question?

khieta commented 4 years ago

Yes, thanks!