You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: doc/development/deprecations.rst
+10
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,16 @@ deprecations are listed below.
9
9
Pending deprecations
10
10
--------------------
11
11
12
+
* The ``ControlledQubitUnitary`` will stop accepting `QubitUnitary` objects as arguments as its ``base``. Instead, use ``qml.ctrl`` to construct a controlled `QubitUnitary`.
13
+
14
+
- Deprecated in v0.41
15
+
- Will be removed in v0.42
16
+
17
+
* The ``control_wires`` argument in the ``qml.ControlledQubitUnitary`` class is deprecated. Instead, use the ``wires`` argument.
18
+
19
+
- Deprecated in v0.41
20
+
- Will be removed in v0.42
21
+
12
22
* The property ```MeasurementProcess.return_type``` has been deprecated.
13
23
If observable type checking is needed, please use direct ```isinstance```; if other text information is needed, please use class name, or another internal temporary private member ``_shortname``.
its settings can be modified with `update`, which returns a new `QNode` object. Here is an example
87
89
of updating a QNode's `diff_method`:
90
+
88
91
```pycon
89
92
>>> print(circuit.diff_method)
90
93
best
@@ -158,6 +161,13 @@
158
161
159
162
<h3>Deprecations 👋</h3>
160
163
164
+
* The ``ControlledQubitUnitary`` will stop accepting `QubitUnitary` objects as arguments as its ``base``. Instead, use ``qml.ctrl`` to construct a controlled `QubitUnitary`.
Copy file name to clipboardexpand all lines: pennylane/ops/op_math/controlled_ops.py
+96-51
Original file line number
Diff line number
Diff line change
@@ -34,17 +34,31 @@
34
34
INV_SQRT2=1/qml.math.sqrt(2)
35
35
36
36
37
+
def_deprecate_control_wires(control_wires):
38
+
ifcontrol_wires!="unset":
39
+
warnings.warn(
40
+
"The control_wires input to ControlledQubitUnitary is deprecated and will be removed in v0.42. "
41
+
"Please note that the second positional arg of your input is going to be the new wires, following wires=controlled_wires+target_wires, where target_wires is the optional arg wires in the legacy interface.",
Apply an arbitrary fixed unitary to ``wires`` with control from the ``control_wires``.
48
+
r"""ControlledQubitUnitary(U, wires)
49
+
Apply an arbitrary fixed unitary matrix ``U`` to ``wires``. If ``n = len(wires) `` and ``U`` has ``k`` wires, then the first ``n - k`` from ``wires`` serve as control, and ``U`` lives on the last ``k`` wires.
50
+
51
+
.. warning::
52
+
53
+
The ``control_wires`` argument is deprecated and will be removed in
54
+
v0.42. Please use the ``wires`` argument instead.
41
55
42
56
In addition to default ``Operation`` instance attributes, the following are
43
57
available for ``ControlledQubitUnitary``:
44
58
45
-
* ``control_wires``: wires that act as control for the operation
59
+
* ``control_wires``: (deprecated) wires that act as control for the operation
60
+
* ``wires``: wires of the final controlled unitary, consisting of control wires following by target wires
46
61
* ``control_values``: the state on which to apply the controlled operation (see below)
47
-
* ``target_wires``: the wires the unitary matrix will be applied to
48
62
* ``work_wires``: wires made use of during the decomposition of the operation into native operations
49
63
50
64
**Details:**
@@ -59,9 +73,10 @@ class ControlledQubitUnitary(ControlledOp):
59
73
operation. If passing a matrix, this will be used to construct a QubitUnitary
60
74
operator that will be used as the base operator. If providing a ``qml.QubitUnitary``,
61
75
this will be used as the base directly.
62
-
control_wires (Union[Wires, Sequence[int], or int]): the control wire(s)
63
-
wires (Union[Wires, Sequence[int], or int]): the wire(s) the unitary acts on
64
-
(optional if U is provided as a QubitUnitary)
76
+
wires (Union[Wires, Sequence[int], or int]): the wires the full
77
+
controlled unitary acts on, composed of the controlled wires followed
78
+
by the target wires
79
+
control_wires (Union[Wires, Sequence[int], or int]): (deprecated) the control wire(s)
65
80
control_values (List[int, bool]): a list providing the state of the control qubits to
66
81
control on (default is the all 1s state)
67
82
unitary_check (bool): whether to check whether an array U is unitary when creating the
@@ -75,16 +90,9 @@ class ControlledQubitUnitary(ControlledOp):
75
90
both wires ``0`` and ``1``:
76
91
77
92
>>> U = np.array([[ 0.94877869, 0.31594146], [-0.31594146, 0.94877869]])
0 commit comments