Skip to content

Commit

Permalink
Merge branch 'master' into tests/warning_as_error
Browse files Browse the repository at this point in the history
  • Loading branch information
mlxd authored Oct 24, 2024
2 parents aff8399 + 50049a9 commit c12b44c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions doc/releases/changelog-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@
* A more sensible error message is raised from a `RecursionError` encountered when accessing properties and methods of a nested `CompositeOp` or `SProd`.
[(#6375)](https://github.com/PennyLaneAI/pennylane/pull/6375)

* Moved the calculation of `shift_len = len(shifts)` outside of a loop in the `QFT.compute_decomposition` static method, reducing redundant recalculations and improving performance.
[(#6434)](https://github.com/PennyLaneAI/pennylane/pull/6434)

<h3>Breaking changes 💔</h3>

* `AllWires` validation in `QNode.construct` has been removed.
Expand Down Expand Up @@ -407,6 +410,7 @@ Lillian M. A. Frederiksen,
Pietropaolo Frisoni,
Emiliano Godinez,
Austin Huang,
Jacob Kitchen,
Korbinian Kottmann,
Christina Lee,
William Maxwell,
Expand Down
3 changes: 2 additions & 1 deletion pennylane/templates/subroutines/qft.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,12 @@ def compute_decomposition(wires, n_wires): # pylint: disable=arguments-differ,u
"""
shifts = [2 * np.pi * 2**-i for i in range(2, n_wires + 1)]

shift_len = len(shifts)
decomp_ops = []
for i, wire in enumerate(wires):
decomp_ops.append(qml.Hadamard(wire))

for shift, control_wire in zip(shifts[: len(shifts) - i], wires[i + 1 :]):
for shift, control_wire in zip(shifts[: shift_len - i], wires[i + 1 :]):
op = qml.ControlledPhaseShift(shift, wires=[control_wire, wire])
decomp_ops.append(op)

Expand Down

0 comments on commit c12b44c

Please sign in to comment.