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$?
Asked
Active
Viewed 80 times
1
Sanchayan Dutta
- 17,945
- 8
- 50
- 112
user1319236
- 377
- 2
- 9
1 Answers
2
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).
Sanchayan Dutta
- 17,945
- 8
- 50
- 112