From bc688584d3b5172d1f8935e4e6599544514beee0 Mon Sep 17 00:00:00 2001 From: Mudit Pandey Date: Tue, 17 Sep 2024 14:19:08 -0400 Subject: [PATCH] Fix indexing in code example --- pennylane/templates/subroutines/arbitrary_unitary.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pennylane/templates/subroutines/arbitrary_unitary.py b/pennylane/templates/subroutines/arbitrary_unitary.py index e36d212b99d..3527bc0145b 100644 --- a/pennylane/templates/subroutines/arbitrary_unitary.py +++ b/pennylane/templates/subroutines/arbitrary_unitary.py @@ -83,8 +83,8 @@ class ArbitraryUnitary(Operation): .. code-block:: python def arbitrary_nearest_neighbour_interaction(weights, wires): - for w in range(0, len(wires) - 1, 2): - ArbitraryUnitary(weights, wires=[w, w + 1]) + for i, w in enumerate(range(0, len(wires) - 1, 2)): + ArbitraryUnitary(weights[i], wires=[w, w + 1]) Args: weights (tensor_like): The angles of the Pauli word rotations, needs to have length :math:`4^n - 1`