Skip to content

Add QASM3 export support for IonQ native gates#239

Open
dlyongemallo wants to merge 1 commit intoqiskit-community:mainfrom
dlyongemallo:217-qasm3_export
Open

Add QASM3 export support for IonQ native gates#239
dlyongemallo wants to merge 1 commit intoqiskit-community:mainfrom
dlyongemallo:217-qasm3_export

Conversation

@dlyongemallo
Copy link
Copy Markdown

Summary

Adds QASM3 definitions for IonQ native gates so that output of qiskit.qasm3.dumps can be parsed by openqasm3.parser without error. Fixes #217 and #218.

Details and comments

Adds _define() methods to all four IonQ native gates (GPIGate, GPI2Gate, MSGate, ZZGate). This provides decompositions into standard Qiskit gates that QASM exporters can serialize.

Gate decompositions:

Gate Decomposition
GPIGate(φ) U(π, 2πφ, π - 2πφ)
GPI2Gate(φ) U(π/2, 2πφ - π/2, π/2 - 2πφ)
MSGate(φ0, φ1, θ) RZ + RXX + RZ sequence
ZZGate(θ) RZZ(2πθ)

Testing:

Copilot AI review requested due to automatic review settings January 29, 2026 07:19
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jan 29, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds QASM3 export support for IonQ native gates by implementing _define() methods that decompose each gate into standard Qiskit gates. This resolves issues where circuits using IonQ native gates could not be exported to QASM3 format or were producing invalid QASM3 that failed to parse.

Changes:

  • Added _define() methods to all four IonQ native gates (GPIGate, GPI2Gate, MSGate, ZZGate) providing decompositions into standard Qiskit gates
  • Added comprehensive tests verifying mathematical equivalence between gates and their decompositions
  • Added integration tests for QASM3 export and parsing, including exact reproduction of the reported issue scenario
  • Added openqasm3[parser] test dependency

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
qiskit_ionq/ionq_gates.py Implements _define() methods for all four IonQ native gates, providing decompositions into U, RZ, RXX, and RZZ gates
test/ionq_gates/test_gates.py Adds parametric tests verifying matrix equivalence of decompositions and integration tests for QASM3 export/parsing
requirements-test.txt Adds openqasm3[parser] as a test dependency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

QASM3ExporterError / QASM3ParserError from IonQ native gate program

3 participants