Skip to content

Commit

Permalink
Added Deprecation warnings for CU1Gate, CU3Gate and MCU1Gate (Qiskit#…
Browse files Browse the repository at this point in the history
…13115)

* added deprecation warnings for CU1Gate and MCU1Gate

* fixed file formatting

* deprecate CU3Gate and fix deprecation warnings for CU1Gate and CU3Gate

* fixed docstring inaccuracies

Co-authored-by: Julien Gacon <[email protected]>

* Remove mcu mention in warning

* Update mcp example

Co-authored-by: Julien Gacon <[email protected]>

---------

Co-authored-by: Julien Gacon <[email protected]>
  • Loading branch information
2 people authored and ElePT committed Oct 9, 2024
1 parent 9c9c16d commit 529c45c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
34 changes: 33 additions & 1 deletion qiskit/circuit/library/standard_gates/u1.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class U1Gate(Gate):
.. code-block:: python
circuit = QuantumCircuit(1)
circuit.p(lambda, 0) # or circuit.u(0, 0, lambda)
circuit.p(lambda, 0) # or circuit.u(0, 0, lambda, 0)
Expand Down Expand Up @@ -177,6 +177,22 @@ class CU1Gate(ControlledGate):
This is a diagonal and symmetric gate that induces a
phase on the state of the target qubit, depending on the control state.
.. warning::
This gate is deprecated. Instead, the :class:`.CPhaseGate` should be used
.. math::
CU1(\lambda) = CP(\lambda)
.. code-block:: python
circuit = QuantumCircuit(2)
circuit.cp(lambda, 0, 1)
**Circuit symbol:**
.. parsed-literal::
Expand Down Expand Up @@ -332,6 +348,22 @@ class MCU1Gate(ControlledGate):
This is a diagonal and symmetric gate that induces a
phase on the state of the target qubit, depending on the state of the control qubits.
.. warning::
This gate is deprecated. Instead, the following replacements should be used
.. math::
MCU1(\lambda) = MCP(\lambda)
.. code-block:: python
circuit = QuantumCircuit(5)
circuit.mcp(lambda, list(range(4)), 4)
**Circuit symbol:**
.. parsed-literal::
Expand Down
17 changes: 17 additions & 0 deletions qiskit/circuit/library/standard_gates/u3.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,23 @@ class CU3Gate(ControlledGate):
It is restricted to 3 parameters, and so cannot cover generic two-qubit
controlled gates).
.. warning::
This gate is deprecated. Instead, the :class:`.CUGate` should be used
.. math::
CU3(\theta, \phi, \lambda) = CU(\theta, \phi, \lambda, 0)
.. code-block:: python
circuit = QuantumCircuit(2)
gamma = 0
circuit.cu(theta, phi, lambda, gamma, 0, 1)
**Circuit symbol:**
.. parsed-literal::
Expand Down

0 comments on commit 529c45c

Please sign in to comment.