From 0567effa62d7cefe61da1f9d55e8059303f59a91 Mon Sep 17 00:00:00 2001 From: BrunoLiegiBastonLiegi <45011234+BrunoLiegiBastonLiegi@users.noreply.github.com> Date: Mon, 11 Mar 2024 15:44:12 +0400 Subject: [PATCH] Update src/qibo/models/circuit.py Co-authored-by: Renato Mello --- src/qibo/models/circuit.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/qibo/models/circuit.py b/src/qibo/models/circuit.py index def7a7f6d4..fb038a54e3 100644 --- a/src/qibo/models/circuit.py +++ b/src/qibo/models/circuit.py @@ -94,10 +94,11 @@ def moments(self): moments = [self.nqubits * [None]] moment_index = self.nqubits * [0] for gate in self: - if not isinstance(gate, gates.CallbackGate): - qubits = gate.qubits - else: # special gate acting on all qubits - qubits = tuple(range(self.nqubits)) + qubits = ( + gate.qubits + if not isinstance(gate, gates.CallbackGate) + else tuple(range(self.nqubits)) # special gate acting on all qubits + ) # calculate moment index for this gate idx = max(moment_index[q] for q in qubits)