Skip to content

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

@burgholzer

Description

@burgholzer

Environment

  • Qiskit version: main
  • Python version: Any
  • Operating system: Any

What is happening?

The docstring of the Qiskit UGate states that

Matrix representation:

.. math::

    \newcommand{\rotationangle}{\frac{\theta}{2}}

    U(\theta, \phi, \lambda) =
    \begin{pmatrix}
        \cos\left(\rotationangle\right) & -e^{i\lambda}\sin\left(\rotationangle\right) \\
        e^{i\phi}\sin\left(\rotationangle\right) & e^{i(\phi+\lambda)}\cos\left(\rotationangle\right)
    \end{pmatrix}

and

The matrix representation shown here is the same as in the OpenQASM 3.0 specification <https://openqasm.com/language/gates.html#built-in-gates>,
which differs from the OpenQASM 2.0 specification <https://doi.org/10.48550/arXiv.1707.03429>
by a global phase of
:math:e^{i(\phi+\lambda)/2}.

which is not true when looking at the current OpenQASM 3 docs which state

\begin{split}U(\theta,\phi,\lambda) := \frac{1}{2}\left(\begin{array}{cc}
1+e^{i\theta} & -ie^{i\lambda}(1-e^{i\theta}) \
ie^{i\phi}(1-e^{i\theta}) & e^{i(\phi+\lambda)}(1+e^{i\theta}) \end{array}\right).\end{split}

How can we reproduce the issue?

Look at the docstrings.

What should happen?

There should be consistency in the definitions.

Any suggestions?

I suspect the note in the Qiskit docs shall be updated to reflect that this is not the OpenQASM3 U gate matrix and there is a global phase difference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationSomething is not clear or an error documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions