Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v0.41 Dep & Rmv] Documentation Audit #7000

Merged
merged 12 commits into from
Feb 25, 2025
6 changes: 0 additions & 6 deletions doc/development/guide/architecture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,6 @@ which are themselves operators.
>>> m.obs
PauliZ(wires=['a'])

Furthermore, it specifies a "return type" which defines the kind of measurement performed,
such as expectation, variance, probability, state, or sample.

>>> m.return_type
ObservableReturnTypes.Expectation

For more information, check out the documentation on :doc:`measurements </introduction/measurements>`

QuantumTape
Expand Down
2 changes: 1 addition & 1 deletion pennylane/ops/op_math/controlled_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def __init__(
if hasattr(base, "wires"):
warnings.warn(
"QubitUnitary input to ControlledQubitUnitary is deprecated and will be removed in v0.42. "
"Instead, please use a full matrix as input.",
"Instead, please use a full matrix as input, or try qml.ctrl for controlled QubitUnitary.",
qml.PennyLaneDeprecationWarning,
)
base = base.matrix()
Expand Down
3 changes: 2 additions & 1 deletion pennylane/workflow/qnode.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,8 @@ def __init__(
if kwargs:
if any(k in qml.gradients.SUPPORTED_GRADIENT_KWARGS for k in list(kwargs.keys())):
warnings.warn(
f"Specifying gradient keyword arguments {list(kwargs.keys())} is deprecated and will be removed in v0.42. Instead, please specify all arguments in the gradient_kwargs argument.",
f"Specifying gradient keyword arguments {list(kwargs.keys())} as additional kwargs has been deprecated and will be removed in v0.42. \
Instead, please specify these arguments through the `gradient_kwargs` dictionary argument.",
qml.PennyLaneDeprecationWarning,
)
gradient_kwargs |= kwargs
Expand Down
1 change: 0 additions & 1 deletion tests/capture/test_base_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ def f(x):
@pytest.mark.parametrize(
"op_class, args, kwargs",
[
# (qml.ControlledQubitUnitary, (jnp.eye(2), [0, 1]), {}),
(qml.CH, ([0, 1],), {}),
(qml.CY, ([0, 1],), {}),
(qml.CZ, ([0, 1],), {}),
Expand Down
10 changes: 6 additions & 4 deletions tests/ops/op_math/test_controlled_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,16 @@ def test_pairwise_consistency_with_capture(self):
"""Test that both combinations of control and target wires lead to the same operator"""
base_op = [[0, 1], [1, 0]]

control_wires_1, wires_1 = [0, 1], [2]
op_1 = qml.ControlledQubitUnitary(base_op, wires=control_wires_1 + wires_1)
control_wires_1, target_wires_1 = [0, 1], [2]
op_1 = qml.ControlledQubitUnitary(base_op, wires=control_wires_1 + target_wires_1)

assert op_1.base.wires == Wires(2)
assert op_1.control_wires == Wires([0, 1])

control_wires_2, wires_2 = [0, 1, 2], ()
op_2 = qml.ControlledQubitUnitary(base_op, wires=Wires(control_wires_2) + Wires(wires_2))
control_wires_2, target_wires_2 = [0, 1, 2], ()
op_2 = qml.ControlledQubitUnitary(
base_op, wires=Wires(control_wires_2) + Wires(target_wires_2)
)

assert op_2.base.wires == Wires(2)
assert op_2.control_wires == Wires([0, 1])
Expand Down
2 changes: 1 addition & 1 deletion tests/test_qnode.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_additional_kwargs_is_deprecated():

with pytest.warns(
qml.PennyLaneDeprecationWarning,
match=r"Specifying gradient keyword arguments \[\'atol\'\] is deprecated",
match=r"Specifying gradient keyword arguments \[\'atol\'\] as additional kwargs has been deprecated",
):
QNode(dummyfunc, dev, atol=1)

Expand Down
10 changes: 5 additions & 5 deletions tests/transforms/test_qmc_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,20 @@ def test_apply_controlled_z(n_wires):
unitary and comparing against the one provided in _make_Z."""
n_all_wires = n_wires + 1

wires = Wires(range(n_wires))
target_wires = Wires(range(n_wires))
control_wire = n_wires
work_wires = None

circ = lambda: _apply_controlled_z(
wires=wires, control_wire=control_wire, work_wires=work_wires
wires=target_wires, control_wire=control_wire, work_wires=work_wires
)
u = get_unitary(circ, n_all_wires)

# Note the sign flip in the following. The sign does not matter when performing the Q unitary
# because two Zs are used.
z_ideal = -_make_Z(2**n_wires)

circ = lambda: qml.ControlledQubitUnitary(z_ideal, wires=control_wire + wires)
circ = lambda: qml.ControlledQubitUnitary(z_ideal, wires=control_wire + target_wires)
u_ideal = get_unitary(circ, n_all_wires)

assert np.allclose(u, u_ideal)
Expand All @@ -121,7 +121,7 @@ def test_apply_controlled_v(n_wires):
unitary and comparing against the one provided in _make_V."""
n_all_wires = n_wires + 1

wires = Wires(range(n_wires))
target_wires = Wires(range(n_wires))
control_wire = Wires(n_wires)

circ = lambda: _apply_controlled_v(target_wire=Wires([n_wires - 1]), control_wire=control_wire)
Expand All @@ -131,7 +131,7 @@ def test_apply_controlled_v(n_wires):
# because two Vs are used.
v_ideal = -_make_V(2**n_wires)

circ = lambda: qml.ControlledQubitUnitary(v_ideal, wires=control_wire + wires)
circ = lambda: qml.ControlledQubitUnitary(v_ideal, wires=control_wire + target_wires)
u_ideal = get_unitary(circ, n_all_wires)

assert np.allclose(u, u_ideal)
Expand Down