[PYTHON] Quantum computer implementation of quantum walk 3

Quantum computer implementation of quantum walk 3 ~ Cycle 3 Hadamard walk ~

*** Summarize the implementation of Hadamard walk on cycle $ 3 $ ***. In Quantum Walk Quantum Computer Implementation 2, we introduced the case where the cycle size is $ 2 ^ n $, but we also introduced the case where the cycle size is not $ 2 ^ n $. To do. Implement a simple cycle size of $ 3 $. The method introduced here is the same as Efficient quantum circuit implementation of quantum walks.

About Hadamard Walk on Cycle 3

For a brief explanation of the quantum walk, refer to Quantum Walk Quantum Computer Implementation 1.

The cycle to think about this time is image.png

Is. Define a quantum walk on this cycle ($ 00,01,10 $ (0 ~ 2 in decimal))

Coin operator and shift operator

As the overall dynamics $ W=\hat{S}\hat{C}\\ $ It is represented by. The coin operator and shift operator are shown below.

\hat{C}=(I\otimes H)\\
\mbox{However}I=\sum_{x}|x\rangle\langle x|,\quad
H=\frac{1}{\sqrt{2}}\begin{bmatrix}
1&1\\1&-1
\end{bmatrix}
\hat{S}=\sum_{x}|x-1\rangle\langle x|\otimes|0\rangle\langle 0|+|x+1\rangle\langle x|\otimes|1\rangle\langle 1|

Let. However, $ x \ pm 1 $ is considered as $ mod 3 $.

Considering the gates of the coin operator and the `shift operator`, the time evolution of the quantum walk can be expressed as a quantum walk.

In particular, *** Coin operator *** $ \ hat {C} = I \ otimes H $ can be expressed by passing $ H $ only through the qubit of the state. *** Shift operator *** $ \ hat {S} $ is -If the state is `0```, the location ``` x``` is -1 ・ If the state is `1, the location x``` is +1 Think of a gate to do.

Implementation in IBM Q

3qubits ($ q [0] q [1] q [2] $) is used for this implementation. Consider $ q [0] q [1] $ as the qbit corresponding to the place (00,01,10) and $ q [2] $ as the qubit corresponding to the state.

Construction of shift operators (for cycle 3)

I would like to consider an algorithm for +1 operation and -1 operation of $ n $ digit binary, but since $ q [0] q [1] $ also contains $ 11 $, it is necessary to eliminate it well. .. Therefore, based on the shift of the quantum walk on cycle 4 (Quantum computer implementation 1 of quantum walk), add the Switch part excluding the unrelated cycle. ..

To summarize the above, the shift operator is image.png It becomes. Cycle 4 shift operator </ font> + If state 0, location 11 and 10 switches </ font> + If state 1 Location 11 and 00 switches </ font>

Creation of circuit part

Quantum register, classical register, and set quantum circuit qwqc from them

  • Location qbits $ \ Rightarrow q [0] q [1] $
  • State qbits $ \ Rightarrow q [2] $
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister
from qiskit import execute

from qiskit.tools.visualization import plot_histogram

q = QuantumRegister(3, 'q')
c = ClassicalRegister(2, 'c')

qwqc = QuantumCircuit(q,c)

#time
t=1

#Set the initial state
qwqc.h(q[2])
qwqc.s(q[2])

#Time evolution
for i in range(t):
    #Coin operation
    qwqc.h(q[2])
    #shift
    qwqc.x(q[1])
    qwqc.cx(q[2],q[0])
    qwqc.cx(q[1],q[0])
    #-1 rotation fix
    qwqc.x(q[2])
    qwqc.ccx(q[0],q[2],q[1])
    qwqc.x(q[2])
    #+1 rotation fix
    qwqc.ccx(q[1],q[2],q[0])
    qwqc.x(q[0])
    qwqc.ccx(q[0],q[2],q[1])
    qwqc.x(q[0])
    qwqc.ccx(q[1],q[2],q[0])
    
#Observation
qwqc.measure(q[0],c[0])
qwqc.measure(q[1],c[1])

qwqc.draw()

image.png

Simulator results at t = 1

from qiskit import BasicAer
backend_s=BasicAer.get_backend('qasm_simulator')
job_s = execute(qwqc, backend_s,shots=1024)
result_s = job_s.result()
counts_s = result_s.get_counts(qwqc)
plot_histogram(counts_s)

image.png

Results of the actual machine at t = 1

from qiskit.tools.monitor import job_monitor
provider = IBMQ.get_provider(hub='ibm-q')

backend_r=provider.get_backend('ibmqx2')
job_r = execute(qwqc, backend=backend_r,shots=1024)
job_monitor(job_r)

Job Status: job has successfully run

result_r= job_r.result()
counts_r = result_r.get_counts(qwqc)
plot_histogram(counts_r)

image.png

Summary

By doing the same, it is possible to implement a quantum walk on any cycle size. For the implementation of arbitrary cycle n, for the smallest $ N $ which is $ n \ leq 2 ^ N $, shift the cycle $ 2 ^ N $ [quantum walk quantum computer implementation 2](https://qiita. An arbitrary cycle can be created by creating it by the method of com / YNUqw / items / 091f71ef71c75cbbc574) and modifying it by operating a switch.

Recommended Posts