2
$\begingroup$

The first time I create a two qubits, two bits circuit and draw it the output is:

q0_0 
q0_1 
c0_0 
c0_1 

Each subsequent time I run my script (even after clearing all the variables) I get the following:

q1_0
q1_1 
c1_0 
c1_1 
. 
. 
. 
qn_0 
qn_1 
cn_0 
cn_1 

The number next to the qubit or classical bit increases every time. Is this a bug, is there a way to avoid this?

I am using Qiskit 0.19.6.

12th time executing my script

13th time executing my script

$\endgroup$
5
$\begingroup$

It's not a bug, if you don't give concrete names to the registers then Qiskit will number them increasingly. If you want them to have the same name, you can do that like

from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister

qr = QuantumRegister(2, 'q')
cr = ClassicalRegister(2, 'c')
circuit = QuantumCircuit(qr, cr)
circuit.draw()
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.