Skip to content

Commit

Permalink
Update src/qibo/models/circuit.py
Browse files Browse the repository at this point in the history
Co-authored-by: Renato Mello <[email protected]>
  • Loading branch information
BrunoLiegiBastonLiegi and renatomello authored Mar 11, 2024
1 parent 9d5bf38 commit 0567eff
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/qibo/models/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0567eff

Please sign in to comment.