Skip to content

Fix UGate OpenQASM 3 phase note#16079

Open
TSS99 wants to merge 1 commit intoQiskit:mainfrom
TSS99:codex/fix-ugate-openqasm3-doc
Open

Fix UGate OpenQASM 3 phase note#16079
TSS99 wants to merge 1 commit intoQiskit:mainfrom
TSS99:codex/fix-ugate-openqasm3-doc

Conversation

@TSS99
Copy link
Copy Markdown
Contributor

@TSS99 TSS99 commented Apr 24, 2026

Summary

Correct the UGate docstring note that compares Qiskit's matrix convention with the current OpenQASM 3 U definition.

Fixes #15830.

Problem

The existing note says Qiskit's displayed UGate matrix is the same as OpenQASM 3. The current OpenQASM 3 specification defines U with an additional global phase relative to Qiskit's matrix.

Root cause

The docstring appears to describe an older OpenQASM 3 convention. The live OpenQASM 3 specification now defines U(theta, phi, lambda) as Qiskit's matrix multiplied by exp(i * theta / 2).

Fix

Update the note to state the current OpenQASM 3 global-phase relationship, while preserving the existing note about earlier OpenQASM definitions.

Tests

  • .venv/bin/python -m black --check qiskit/circuit/library/standard_gates/u.py
  • .venv/bin/python -m ruff check qiskit/circuit/library/standard_gates/u.py
  • Verified numerically that the current OpenQASM 3 formula equals exp(i * theta / 2) times Qiskit's UGate matrix for sampled parameters.

Notes / limitations

This is a documentation-only correction; no runtime behavior changes.

AI/LLM disclosure

  • I didn't use LLM tooling, or only used it privately.
  • I used the following tool to help write this PR description: OpenAI Codex (GPT-5)
  • I used the following tool to generate or modify code: OpenAI Codex (GPT-5)

@TSS99 TSS99 requested a review from a team as a code owner April 24, 2026 06:46
@qiskit-bot qiskit-bot added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Apr 24, 2026
@qiskit-bot
Copy link
Copy Markdown
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

One or more of the following people are relevant to this code:

  • @Cryoris
  • @Qiskit/terra-core
  • @ajavadia

@ShellyGarion ShellyGarion added documentation Something is not clear or an error documentation Changelog: None Do not include in the GitHub Release changelog. labels Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changelog: None Do not include in the GitHub Release changelog. Community PR PRs from contributors that are not 'members' of the Qiskit repo documentation Something is not clear or an error documentation

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Incorrect statement about consistency between Qiskit UGate and OpenQASM 3 U definition

3 participants