What's the default value for a state created by QuantumRegister(1,'name_of_the_register')? Is it a $|0\rangle$ or a $|1\rangle$?


Here's the source code for quantumregister.py and quantumcircuit.py.

The default is $|0\rangle$. The code goes like:

from qiskit import QuantumCircuit, QuantumRegister
qr = QuantumRegister(1) 
circuit = QuantumCircuit(qr) 

By the way, if you're just beginning with Qiskit, you could check out Dr. Moran's textbook (this specific example is covered in chapter 5, ~p. 83).


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.