t b a b a
t b a b a
t b a b a
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
# "Disentangle" the extra ancilla<br />
gr.hadamard(2)<br />
gr.cnot(2,8)<br />
gr.hadamard(2)<br />
gr.cnot(2,7)<br />
# Measure and output the extra ancilla<br />
print gr.measure(7)<br />
print gr.measure(8)<br />
#gr.print_adj_list()<br />
#gr.print_stabilizer()<br />
print<br />
# Measure and output syndrome<br />
for i in range(9,15):<br />
gr.hadamard(i)<br />
print gr.measure(i)<br />
print<br />
############# error correction ###############<br />
# Error correction according to the syndrome and extra ancilla<br />
gr.bitflip(2)<br />
gr.phaseflip(3)<br />
##### Normal syndrome extraction to double-check #####<br />
for i in range(9+6,15+6):<br />
gr.hadamard(i)<br />
# Z syndrome<br />
gr.cnot(9+6,3)<br />
gr.cnot(9+6,4)<br />
gr.cnot(9+6,5)<br />
gr.cnot(9+6,6)<br />
gr.cnot(10+6,1)<br />
104