Skip to content

Commit

Permalink
Fix controlled qubit unitary usage (#1310)
Browse files Browse the repository at this point in the history
**Title:**
Adjust interface of `ControlledQubitUnitary` to be compatible with
PennyLane v0.41

**Summary:**
changed 5 occurences in
demonstrations/tutorial_classically_boosted_vqe.py and
demonstrations/tutorial_testing_symmetry.py

**Related Shortcut Stories:**
[sc-80842]

---------

Co-authored-by: Alex Preciado <[email protected]>
  • Loading branch information
JerryChen97 and Alex-Preciado authored Feb 3, 2025
1 parent 0aaa21b commit 68c6f08
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
],
"dateOfPublication": "2022-10-31T00:00:00+00:00",
"dateOfLastModification": "2024-12-13T00:00:00+00:00",
"dateOfLastModification": "2025-01-23T00:00:00+00:00",
"categories": [
"Quantum Chemistry"
],
Expand Down
2 changes: 1 addition & 1 deletion demonstrations/tutorial_classically_boosted_vqe.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def hadamard_test(Uq, Ucl, component="real"):

qml.Hadamard(wires=[0])
qml.ControlledQubitUnitary(
Uq.conjugate().T @ Ucl, control_wires=[0], wires=wires[1:]
Uq.conjugate().T @ Ucl, wires=wires
)
qml.Hadamard(wires=[0])

Expand Down
2 changes: 1 addition & 1 deletion demonstrations/tutorial_testing_symmetry.metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}
],
"dateOfPublication": "2023-01-24T00:00:00+00:00",
"dateOfLastModification": "2024-11-06T00:00:00+00:00",
"dateOfLastModification": "2025-01-23T00:00:00+00:00",
"categories": [
"Algorithms",
"Quantum Computing"
Expand Down
8 changes: 4 additions & 4 deletions demonstrations/tutorial_testing_symmetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,14 @@ def prep_plus():

# Implement controlled symmetry operations on system
def CU_sys():
qml.ControlledQubitUnitary(c_mat @ c_mat, control_wires=[aux[0]], wires=system)
qml.ControlledQubitUnitary(c_mat, control_wires=[aux[1]], wires=system)
qml.ControlledQubitUnitary(c_mat @ c_mat, wires=[aux[0]] + list(system))
qml.ControlledQubitUnitary(c_mat, wires=[aux[1]] + list(system))


# Implement controlled symmetry operations on copy
def CU_cpy():
qml.ControlledQubitUnitary(c_mat @ c_mat, control_wires=[aux[0]], wires=copy)
qml.ControlledQubitUnitary(c_mat, control_wires=[aux[1]], wires=copy)
qml.ControlledQubitUnitary(c_mat @ c_mat, wires=[aux[0]] + list(copy))
qml.ControlledQubitUnitary(c_mat, wires=[aux[1]] + list(copy))

######################################################################
# Let’s combine everything and actually run our circuit!
Expand Down

0 comments on commit 68c6f08

Please sign in to comment.