Skip to content

Commit

Permalink
Fix CPhaseGate parameter name mismatch in API docs (#13242)
Browse files Browse the repository at this point in the history
* changed graphic notation to theta

* updated phase gate

* update CRZ gate for theta and lambda to match

* update CU1 Gate

* update U1Gate documentation

---------

Co-authored-by: Jake Lishman <[email protected]>
  • Loading branch information
cameron-d28 and jakelishman authored Oct 29, 2024
1 parent d7be00e commit 5de6a00
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
18 changes: 9 additions & 9 deletions qiskit/circuit/library/standard_gates/p.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,32 @@ class PhaseGate(Gate):
.. code-block:: text
┌──────┐
q_0: ┤ P(λ) ├
q_0: ┤ P(θ) ├
└──────┘
**Matrix Representation:**
.. math::
P(\lambda) =
P(\theta) =
\begin{pmatrix}
1 & 0 \\
0 & e^{i\lambda}
0 & e^{i\theta}
\end{pmatrix}
**Examples:**
.. math::
P(\lambda = \pi) = Z
P(\theta = \pi) = Z
.. math::
P(\lambda = \pi/2) = S
P(\theta = \pi/2) = S
.. math::
P(\lambda = \pi/4) = T
P(\theta = \pi/4) = T
.. seealso::
Expand All @@ -70,7 +70,7 @@ class PhaseGate(Gate):
.. math::
P(\lambda) = e^{i{\lambda}/2} RZ(\lambda)
P(\theta) = e^{i{\theta}/2} RZ(\theta)
Reference for virtual Z gate implementation:
`1612.00858 <https://arxiv.org/abs/1612.00858>`_
Expand Down Expand Up @@ -175,7 +175,7 @@ class CPhaseGate(ControlledGate):
q_0: ─■──
λ
θ
q_1: ─■──
Expand All @@ -189,7 +189,7 @@ class CPhaseGate(ControlledGate):
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & e^{i\lambda}
0 & 0 & 0 & e^{i\theta}
\end{pmatrix}
.. seealso::
Expand Down
18 changes: 9 additions & 9 deletions qiskit/circuit/library/standard_gates/rz.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,20 +178,20 @@ class CRZGate(ControlledGate):
q_0: ────■────
┌───┴───┐
q_1: ┤ Rz(λ) ├
q_1: ┤ Rz(θ) ├
└───────┘
**Matrix representation:**
.. math::
CRZ(\lambda)\ q_0, q_1 =
I \otimes |0\rangle\langle 0| + RZ(\lambda) \otimes |1\rangle\langle 1| =
CRZ(\theta)\ q_0, q_1 =
I \otimes |0\rangle\langle 0| + RZ(\theta) \otimes |1\rangle\langle 1| =
\begin{pmatrix}
1 & 0 & 0 & 0 \\
0 & e^{-i\frac{\lambda}{2}} & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & e^{i\frac{\lambda}{2}}
0 & 0 & 0 & e^{i\frac{\theta}{2}}
\end{pmatrix}
.. note::
Expand All @@ -205,19 +205,19 @@ class CRZGate(ControlledGate):
.. code-block:: text
┌───────┐
q_0: ┤ Rz(λ) ├
q_0: ┤ Rz(θ) ├
└───┬───┘
q_1: ────■────
.. math::
CRZ(\lambda)\ q_1, q_0 =
|0\rangle\langle 0| \otimes I + |1\rangle\langle 1| \otimes RZ(\lambda) =
CRZ(\theta)\ q_1, q_0 =
|0\rangle\langle 0| \otimes I + |1\rangle\langle 1| \otimes RZ(\theta) =
\begin{pmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & e^{-i\frac{\lambda}{2}} & 0 \\
0 & 0 & 0 & e^{i\frac{\lambda}{2}}
0 & 0 & e^{-i\frac{\theta}{2}} & 0 \\
0 & 0 & 0 & e^{i\frac{\theta}{2}}
\end{pmatrix}
.. seealso::
Expand Down
22 changes: 11 additions & 11 deletions qiskit/circuit/library/standard_gates/u1.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class U1Gate(Gate):
.. math::
U1(\lambda) = P(\lambda)= U(0,0,\lambda)
U1(\theta) = P(\theta)= U(0,0,\theta)
.. code-block:: python
Expand All @@ -49,32 +49,32 @@ class U1Gate(Gate):
.. code-block:: text
┌───────┐
q_0: ┤ U1(λ) ├
q_0: ┤ U1(θ) ├
└───────┘
**Matrix Representation:**
.. math::
U1(\lambda) =
U1(\theta) =
\begin{pmatrix}
1 & 0 \\
0 & e^{i\lambda}
0 & e^{i\theta}
\end{pmatrix}
**Examples:**
.. math::
U1(\lambda = \pi) = Z
U1(\theta = \pi) = Z
.. math::
U1(\lambda = \pi/2) = S
U1(\theta = \pi/2) = S
.. math::
U1(\lambda = \pi/4) = T
U1(\theta = \pi/4) = T
.. seealso::
Expand All @@ -83,7 +83,7 @@ class U1Gate(Gate):
.. math::
U1(\lambda) = e^{i{\lambda}/2} RZ(\lambda)
U1(\theta) = e^{i{\theta}/2} RZ(\theta)
:class:`~qiskit.circuit.library.standard_gates.U3Gate`:
U3 is a generalization of U2 that covers all single-qubit rotations,
Expand Down Expand Up @@ -202,21 +202,21 @@ class CU1Gate(ControlledGate):
q_0: ─■──
λ
θ
q_1: ─■──
**Matrix representation:**
.. math::
CU1(\lambda) =
CU1(\theta) =
I \otimes |0\rangle\langle 0| + U1 \otimes |1\rangle\langle 1| =
\begin{pmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & e^{i\lambda}
0 & 0 & 0 & e^{i\theta}
\end{pmatrix}
.. seealso::
Expand Down

0 comments on commit 5de6a00

Please sign in to comment.