I'm considering the repetition code in presence of measurement and qubit error as discussed in SEC IV B of this paper. I am trying to use pymatching for the syndrome decoding using mwvp in presence of qubit error, so it should work but it doesn't. First, I defined the basis setup
import numpy as np
from pymatching import Matching
N = 10 # num of qubits
H = np.zeros((N-1,N), dtype = int) # check-matrix
for i in range(N-1):
H[i,i] = 1
H[i,(i+1)] = 1
Consider the following syndrome measurement :
L = 10
z = np.array([[0, 0, 0, 0, 1, 1, 1, 1, 1, 1],
[0, 0, 1, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 0, 0, 0, 0, 0, 0, 1],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 0, 0, 0]])
Here z[:,i] represents the syndrome measurements at time $t = i$. The decoding can be done as follow:
m = Matching(H, repetitions=L)
c = m.decode(z)
np.array([0, 0, 0, 0, 1, 1, 0, 0, 1, 0], dtype=uint8)
but the corrections are incorrect. On the other hand, if I just take the final syndrome at $t = L$ then
m = Matching(H)
z = z[:,-1]
c = m.decode(z)
np.array([0, 1, 1, 0, 0, 1, 0, 0, 0, 0], dtype=uint8)
which in fact the correct correction operators. I want to know why does the repetition approach gives the wrong result, and way to improve upon that. Thanks
