0

I have read several papers about quantum computing. It looks like any algorithm consists of several phases. For example in Grover algorithm initially qubits must be initialized from reset state $|0\rangle$ and sent through Hadamard gate. After that computer must do several runs (shots?) via oracle and amplifier.

Question: schemas of Grover algorithm contain single diagram schema from left to right.How does a quantum computer knows where is initialization phase and where is oracle with amplifier? I mean if I run multiple times same schema then it starts from schema most left gates from initialization phase which I guess must be skipped during oracle-amplifier repetitions?

I guess initialization must be executed once only and after that repeat runs/shots as many times as needed, is this correct or not? How to declare this in schema? Or how to separate initialization phase from repetitive steps in Qiskit language? I looked at many Qiskit programs and do not see any algorithm separator from init steps to algorithm steps.

What did I miss? Are my assumptions incorrect?

epelaez
  • 3,005
  • 1
  • 10
  • 31
nckm
  • 3
  • 1

1 Answers1

1

When you consider a quantum circuit, it is often (if not always) assumed that the circuit starts in the state where all the qubits are in state $|0\rangle$. The "initialization part" is simply the first gates you apply in an algorithm, it does not play any particular role.

In Qiskit, using the initialize function simply adds gates that will create the desired state starting from the all-$|0\rangle$ state. So if you're running multiple shots of the algorithm, the workflow goes as follow:

  1. Set the starting state to the all-$|0\rangle$ state

  2. a. Apply the initialization gates

    b. Apply the remaining of the algorithm

  3. Measure and retrieve the result

  4. Repeat

Note that you always reset to state to $|0\rangle$ before another shot, which is why the "initialization part" is just yet another part of the algorithm. You cannot execute the initialization step once and for all for all your shots, since you modify the state of your qubits when running your algorithms, which is why you have to redo it every time: in order to have a clean state to run the algorithm on.

Tristan Nemoz
  • 8,694
  • 3
  • 11
  • 39