4
$\begingroup$

I've just started to learn Quantum computing with Qiskit: I'm reading the Qiskit documentation and the book "Quantum Computing in Practice with Qiskit® and IBM Quantum Experience®".

In this book, on page 79 we can read: "..., as we set up our qubit to start as 0, ..."

Can we set up the start value for a quantum register?

Because I think I have read that they have its default value to 0, and we only can set it to one using the NOT gate.

I have tried to set it to 0 in Quantum Experience and I haven't found how to do it, and also with Python and I haven't found it.

$\endgroup$
1

2 Answers 2

3
$\begingroup$

One of the seven DiVincenzo's criteria is the ability to initialize the state of the qubits to a simple fiducial state. In most quantum hardware, this is taken to be the state $|0\rangle^{\otimes n} = \overbrace{|0\rangle \otimes |0\rangle \otimes \cdots \otimes |0\rangle}^{n \ times} = |0 0 \cdots 0\rangle$.

If you create a quantum circuit on IBM hardware and pretty much all other hardware platforms, then the initial state is taken exactly to be this $|0\rangle^{\otimes n} $ state. For example, a 3 qubit circuit will starts out like this:

enter image description here

Then you can operate on this initial state by applying different quantum gates. For example:

enter image description here


Note that the basis in quantum computing is taken to be $|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$ and $|1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix} $. This is known as the computational basis.

$\endgroup$
2
  • 1
    $\begingroup$ Thanks for your answer. Do we decide which initial value will have the quantum register or this register will have the same initial value regardless of what we do? I think that "set up" means intentionality: we do something to set this value to the register. $\endgroup$
    – VansFannel
    Feb 8, 2021 at 7:53
  • 1
    $\begingroup$ Every qubit will start in the initial state $|0\rangle$. You do not need to specify anything. The moment you create a circuit, the initial state of each qubit is in the state $|0\rangle$. $\endgroup$
    – KAJ226
    Feb 8, 2021 at 8:06
3
$\begingroup$

The default value for a quantum register depends on the hardware. In the case of most of the IBM hardware, that's $|0\rangle$.

However, Qiskit is hardware agnostic and do not assume an initial state. In order to initialize your circuit, you need to use the instruction Initialize. You can initialize with the values $|0\rangle$ (0), $|1\rangle$ (1), $|+\rangle$ ( +), $|-\rangle$ (-), $|i\rangle$ (r), and $|\mbox{-}i\rangle$ (l).

from qiskit import QuantumCircuit
from qiskit.extensions.quantum_initializer.initializer import Initialize

circuit = QuantumCircuit(6)
circuit.append(Initialize("10+-lr"), range(6))
circuit.draw()
     ┌──────────────────────────┐
q_0: ┤0                         ├
     │                          │
q_1: ┤1                         ├
     │                          │
q_2: ┤2                         ├
     │  initialize(1,0,+,-,l,r) │
q_3: ┤3                         ├
     │                          │
q_4: ┤4                         ├
     │                          │
q_5: ┤5                         ├
     └──────────────────────────┘

Notice that the instruction Initialize, when decomposed, starts with a Reset instruction (|0>):

circuit.decompose().draw()
          ┌───┐ ┌───┐ 
q_0: ─|0>─┤ H ├─┤ S ├─
          ├───┤┌┴───┴┐
q_1: ─|0>─┤ H ├┤ SDG ├
          ├───┤└┬───┬┘
q_2: ─|0>─┤ X ├─┤ H ├─
          ├───┤ └───┘ 
q_3: ─|0>─┤ H ├───────
          └───┘       
q_4: ─|0>─────────────
          ┌───┐       
q_5: ─|0>─┤ X ├───────
          └───┘       
$\endgroup$
1
  • $\begingroup$ Wow! There are a lot of things to learn! Thanks a lot! $\endgroup$
    – VansFannel
    Feb 8, 2021 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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