Hi,
At the end of notebook Modeling the toric code on a quantum computer | PennyLane Demos, there are these tasks which I’m trying to do.
Note
I encourage dedicated readers to calculate the phase accumulated by exchanging:
1. A Z Group excitation and a Z Group Excitation
2. An X Group excitation and an X Group Excitation
3. A combination Ψ particle and an X Group excitation
4. A combination Ψ particle and a Z Group excitation
5. A combination Ψ particle with another Ψ particle
The combination particle should behave like a standard fermion. You can create and move combination particles by applying PauliY operations.
For task 1, i.e. A Z Group excitation and a Z Group Excitation, this is my code
prep1 = [(1, 1), (2, 1)]
prep2 = [(1, 3)]
loop1 = [(1,2),(2,2),(3,2),(3,1),(2,1),(2,2)]
# WITHOUT LOOPING
expvals = excitations(prep1 + prep2, [])
x_expvals, z_expvals = separate_expvals(expvals)
fig, ax = excitation_plot(x_expvals, z_expvals)
ax.plot(*zip(*(prep1)), color="maroon", linewidth=10)
ax.plot(*zip(*(prep2)), color="maroon", linewidth=10)
display(plt.show())
z_around_z = hadamard_test(prep1 + prep2, [], [], [])
print("WITHOUT LOOPING - Mutual exchange statistics - Move z excitation around z excitation: ", z_around_z)
# WITH LOOPING
expvals = excitations(prep1 + prep2 + loop1, [])
x_expvals, z_expvals = separate_expvals(expvals)
fig, ax = excitation_plot(x_expvals, z_expvals)
ax.plot(*zip(*(prep1)), color="maroon", linewidth=10)
ax.plot(*zip(*(prep2 + loop1)), color="maroon", linewidth=10)
display(plt.show())
z_around_z = hadamard_test(prep1 + prep2, [], loop1, [])
print("WITH LOOPING - Mutual exchange statistics - Move z excitation around z excitation: ", z_around_z)
I did with and without looping to compare the output of the layout and hadamard test.
Question 1: Without any looping, I’m getting +1 from the Hadamard test and 0.0 with looping. Can I know which one is the correct output? Is my looping path correct since I see some “extra” excitations in my loop path?
Question 2: I modified the excitation and Hadamard test code to work with combination Ψ particle using PauliY operator. Then, I did the task 3, i.e. A combination Ψ particle and an X Group excitation. The output is as below (with and without looping). Similar to the previous question’s observations, without looping, I’m getting +1 from Hadamard test and 0.0 with looping. Can I know which one is the correct output? Is my looping path correct since I see some “extra” excitations in my loop path?
Thank you.