GlobalPhaseGate causing circuit.depth()
error
#12426
Labels
bug
Something isn't working
mod: circuit
Related to the core of the `QuantumCircuit` class or the circuit library
Milestone
Environment
What is happening?
Greetings,
Hope all are well. I have noticed that when you apply the GlobalPhaseGate to a circuit, and then try to retrieve the depth of the circuit, it causes an error due to the GlobalPhaseGate instruction not using any qubit indices. I think this should be fixed inside the
.depth()
method as perhaps a special case.How can we reproduce the issue?
This will output the following error:
What should happen?
Inside the
.depth()
method, the code should simply pass when the instruction is a GlobalPhaseGate. Since it's not, because GlobalPhaseGate has no qubit index as parameter, it causes thelevels
variable to be[]
, thus raising the error.Any suggestions?
I tried this and it worked:
The text was updated successfully, but these errors were encountered: