-
Notifications
You must be signed in to change notification settings - Fork 116
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
Add support for most OpenQASM 2 and 3 standard gates. #156
Conversation
There are number of differences between pyzx's and qiskit's interpretation of qasm gates, leading to user confusion. This PR adds a unit test to document these differences. Users or developers may trigger a test failure to see an error message showing the difference between the pyzx and qiskit versions of a qasm gate.
The `p` gate was added as a standard gate to `qelib1.inc` in Qiskit/qiskit#4765.
…us gates. Add `rx`, `ry`, `rz`, `u1`, and `p` to the `qasm_gate_table`. Treat `rz`, `u1`, and `p` as synonyms, since global phases don't matter.
Add `cu1` as a synonym for `cp`. Add tests for gates added/removed from the standard library between OpenQASM 2 and 3.
… transpiler. Add test to verify fix of zxcalc#158.
Also simplify the unit test a bit.
@jvdwetering I'm slightly unsure about whether |
There are a few outstanding gates in |
to_basic_gates should itself return a list of basic gates, so it should not have to be called recursively. |
I fixed the The only remaining gates which are in the OpenQASM standard libraries which aren't implemented yet are: |
I've never seen anyone use those gates, so I think it's fine if these are not implemented for now. |
Can this be merged? |
AFAIK, yes. Unless you have any comments or requests about the code. |
p.s. I just want to thank @jakelishman for his guidance in explaining the difference between how OpenQASM 2 and 3 represents the gates, which made this PR possible. |
Adds support for the most common OpenQASM 2 and 3 standard library gates, and a unit test to ensure that the implementations in pyzx and qiskit are the same up to a global phase.
This PR fixes #153 and #158, adds tests to verify #102 and #103, and should now go most of the way towards completing #87 and #116.