Add all standard OpenQASM gates - #592
Open
thierry-martinez wants to merge 6 commits into
Open
Conversation
This commit adds the following gates specified in the OpenQASM 3.0 specification: SDG, T, TDG, SX, SXDG, CY, P, U, CP, CRX, CRY, CRZ, CU, CSWAP, and GPHASE. Support for GPHASE is currently limited: the gate is ignored by the circuit simulator and the transpiler. It is useful, however, to have it internally in order to add control to the decompositions of the other gates. Additionally, this commit adds the CJ gate, which is useful internally for adding control to decompositions that involve J gates. These additions were motivated by the issue TeamGraphix/graphix-qasm-parser#14. The OpenQASM parser plugin can now parse all the gates and map them to native Graphix gates without translation, except for `u1`, `u2`, and `u3`, which are maintained for compatibility with OpenQASM 2.0 and are translated.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #592 +/- ##
==========================================
+ Coverage 89.27% 90.05% +0.77%
==========================================
Files 49 49
Lines 7798 8248 +450
==========================================
+ Hits 6962 7428 +466
+ Misses 836 820 -16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
thierry-martinez
added a commit
to thierry-martinez/graphix-qasm-parser
that referenced
this pull request
Aug 25, 2026
This commit adds support for all the gates specified by the OpenQASM 3.0 specification that were previously missing: SDG, T, TDG, SX, SXDG, CY, P, U, CP, CRX, CRY, CRZ, CU, CSWAP, and GPHASE. These gates are also added natively in Graphix in TeamGraphix/graphix#592, eliminating the need for translation. The gates u1, u2, and u3, which are retained for compatibility with OpenQASM 2.0, are translated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit adds the following gates specified in the OpenQASM 3.0 specification: SDG, T, TDG, SX, SXDG, CY, P, U, CP, CRX, CRY, CRZ, CU, CSWAP, and GPHASE.
Support for GPHASE is currently limited: the gate is ignored by the circuit simulator and the transpiler. It is useful, however, to have it internally in order to add control to the decompositions of the other gates.
Additionally, this commit adds the CJ gate, which is useful internally for adding control to decompositions that involve J gates.
These additions were motivated by the issue TeamGraphix/graphix-qasm-parser#14. The OpenQASM parser plugin can now parse all the gates and map them to native Graphix gates without translation, except for
u1,u2, andu3, which are maintained for compatibility with OpenQASM 2.0 and are translated.