Skip to content

Add all standard OpenQASM gates - #592

Open
thierry-martinez wants to merge 6 commits into
TeamGraphix:masterfrom
thierry-martinez:add_openqasm_gates
Open

Add all standard OpenQASM gates#592
thierry-martinez wants to merge 6 commits into
TeamGraphix:masterfrom
thierry-martinez:add_openqasm_gates

Conversation

@thierry-martinez

Copy link
Copy Markdown
Collaborator

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.

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

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.05%. Comparing base (f92af95) to head (147eaac).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.
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

Successfully merging this pull request may close these issues.

1 participant