def sample(L, p, samples=1000, cutoff=200):
'''Repeated single shot corrections for the toric code with perfect measurements.
Return an array of nb of cycles until failure for a given L and p.'''
results = []
for _ in trange(samples, desc='%d; %.2f'%(L,p), leave=False):
code = ToricCode(L)
i = 1
while code.step_error_and_perfect_correction(p) and i<cutoff:
i+=1
results.append(i)
return np.array(results, dtype=int)
评论列表
文章目录