*** Summarize the implementation of Hadamard Walk on cycle $ 8 $ ***. If cycle 8 is realized, cycle $ 2 ^ n $ can be increased in the same way, so only the case of cycle 8 will be introduced. The method introduced here is the same as Efficient quantum circuit implementation of quantum walks.
For a brief explanation of the quantum walk, refer to Quantum Walk Quantum Computer Implementation 1.
The cycle to think about this time is
Is. Define a quantum walk on this cycle ($ 000,001, ..., 110,111 $ (0-7 in decimal))
As the overall dynamics
\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 8 $.
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 $ q [3] $ is `0```, then $ q [0] q [1] q [2] $ corresponding to the location` `x``` is -1. -If the state $ q [3] $ is
1```, then $ q [0] q [1] q [2] $ corresponding to the location
`x``` is +1.
Think of a gate to do.
4qubits ($ q [0] q [1] q [2] q [3] $) is used for this implementation. Consider $ q [0] q [1] q [2] $ as the qbit corresponding to the location (000,001, ..., 110,111) and $ q [3] $ as the qubit corresponding to the state.
Considering the algorithm of +1 operation and -1 operation of $ n $ digit binary,
-1 Operation
+1 operation become. If you enter an n-digit binary number, it will be $ \ pm 1 $ respectively.
Each of these gates can be controlled by the state $ q [3] $. Therefore, the shift operator is as follows.
In red frame </ font>, if the lowest qubit is `0```, the top 3 qubits are -1. In <font color = "Blue"> blue frame </ font>, if the lowest qubit is
`1```, the top 3 qubits are +1.
However, in order to implement it with IBM-Q, the toffoli gate with three or more control parts needs to be rewritten as follows.
Quantum register, classical register, and set quantum circuit qwqc from them
Prepare to rewrite the toffoli gate.
def toffoli(circ,c1,c2,c3,t,a1):
circ.ccx(c3,c2,a1)
circ.ccx(a1,c1,t)
circ.ccx(c3,c2,a1)
Use this replacement to create cycle 8 code.
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister
from qiskit import execute
from qiskit.tools.visualization import plot_histogram
q = QuantumRegister(4, 'q')
aq =QuantumRegister(1, 'aq')
c = ClassicalRegister(3, 'c')
qwqc = QuantumCircuit(q,aq,c)
#t times time evolution
t=1
#Initial setting
qwqc.h(q[3])
qwqc.s(q[3])
for i in range(t):
#coin
qwqc.u3(pi/3,0,0,q[3])
#shift-1
qwqc.x(q[3])
qwqc.cx(q[3],q[2])
qwqc.ccx(q[3],q[2],q[1])
toffoli(qwqc,q[1],q[2],q[3],q[0],aq[0])
qwqc.x(q[3])
#shift+1
toffoli(qwqc,q[1],q[2],q[3],q[0],aq[0])
qwqc.ccx(q[3],q[2],q[1])
qwqc.cx(q[3],q[2])
qwqc.measure(q[0],c[0])
qwqc.measure(q[1],c[1])
qwqc.measure(q[2],c[2])
qwqc.draw()
from qiskit import IBMQ
provider = IBMQ.get_provider(hub='ibm-q')
backend_s=provider.get_backend('ibmq_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)
\begin{align}
W\Psi&=SC\left(\frac{1}{\sqrt{2}}|0\rangle\otimes|0\rangle+\frac{i}{\sqrt{2}}|0\rangle\otimes|1\rangle\right)\\
&=\frac{1}{2}S\left((1+i)|0\rangle\otimes|0\rangle+(1-i)|0\rangle\otimes|1\rangle\right)\\
&=\frac{1}{2}\left((1+i)|7\rangle\otimes|0\rangle+(1-i)|1\rangle\otimes|1\rangle\right)
\end{align}
Therefore
from qiskit.tools.monitor import job_monitor
backend_r=provider.get_backend('ibmq_london')
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)
In cycle 8, the amount of control gates is large, and even one time evolution results in a large amount of error accumulation.
It can be seen that the larger the cycle, the larger the accumulation of errors in the actual machine. If the shift operator is created in the same way, the cycle can be increased to $ 8,16,32, .... $.
The quantum algorithm and system of $ n $ qubits with a quantum walk on the cycle as the background is based on this implementation method.
Recommended Posts