We use the qecsim package (https://github.com/qecsim/) to simulate the performance of random Clifford-deformed surface code (CDSC) families and a translation-invariant code realization belonging to one of the high-performance random CDSC families. The details about these CDSCs can be found in this paper: https://arxiv.org/abs/2201.07802.
The key files in the subfolders are sim_random.py, sim_TI.py, _rotatedplanarmpsdecoder_defp.py, and app_defp.py.
The sim_random.py and sim_TI.py simulate the decoder run for the random code and translation-invariant code respectively.
In _rotatedplanarmpsdecoder_defp.py, we modify the create_tn function to accommodate the deformation. In particular, due to the local Clifford deformation, the local probability distribution of Pauli noise in the tensor network changes. Below is the addition to the code.
pi,px,py,pz=prob_dist
prob_dist_mat=[0,1,2,3,4,5]
prob_dist_mat[0]=pi,px,py,pz
prob_dist_mat[1]=pi,pz,py,px
prob_dist_mat[2]=pi,px,pz,py
prob_dist_mat[3]=pi,py,px,pz
prob_dist_mat[4]=pi,py,pz,px
prob_dist_mat[5]=pi,pz,px,py
We write 6 possibilities based on the deformation. We need to consider only the first 3 though since we consider symmetric Z biased noise where px=py.
In app_defp.py, we add the functions deform_matsvecs and permute_error_Pauli. The former specifies the Clifford deformation of the Pauli errors (we work in the Heisenberg picture) and the latter implements that on the error chains.
- def deform_matsvecs(code,decoder,error_model,perm_rates,code_name,layout,rng):
- if layout=='rotated':
perm_mat=np.zeros((code.site_bounds[0]+1,code.site_bounds[1]+1),dtype=int) nrows, ncols=perm_mat.shape # Ly, Lx=perm_mat.shape
perm_vec=np.zeros(np.prod((nrows,ncols))) if code_name[:6]=='random':
- for row,col in np.ndindex(nrows,ncols):
- x=rng.choice((0,1,2,3,4,5),size=1,p=perm_rates) perm_mat[row,col]=x[0] perm_vec[(row+col*ncols)]=perm_mat[row,col]
return perm_mat,perm_vec
and
- def permute_error_Pauli(error_Pauli,perm_vec): #XYZ,ZYX,XZY,YXZ,YZX,ZXY
n_qubits=len(error_Pauli) for i in range(n_qubits):
#if perm_vec[i]==0: XYZ if perm_vec[i]==1: #ZYX
- if error_Pauli[i]=='X':
- error_Pauli[i]='Z'
- elif error_Pauli[i]=='Z':
- error_Pauli[i]='X'
- elif perm_vec[i]==2: #XZY
- if error_Pauli[i]=='Y':
- error_Pauli[i]='Z'
- elif error_Pauli[i]=='Z':
- error_Pauli[i]='Y'
- elif perm_vec[i]==3: #YXZ
- if error_Pauli[i]=='X':
- error_Pauli[i]='Y'
- elif error_Pauli[i]=='Y':
- error_Pauli[i]='X'
- elif perm_vec[i]==4: #XYZ->YZX Schrodinger
- if error_Pauli[i]=='X':
- error_Pauli[i]='Z'
- elif error_Pauli[i]=='Y':
- error_Pauli[i]='X'
- elif error_Pauli[i]=='Z':
- error_Pauli[i]='Y'
- elif perm_vec[i]==5: #XYZ->ZXY Schrodinger
- if error_Pauli[i]=='X':
- error_Pauli[i]='Y'
- elif error_Pauli[i]=='Y':
- error_Pauli[i]='Z'
- elif error_Pauli[i]=='Z':
- error_Pauli[i]='X'
step_error=pt.pauli_to_bsf(''.join(error_Pauli))
return step_error
Lastly, we modify the app_defp function inside app_defp.py to adapt to the Clifford-deformed error configuration.
qecsim is a Python 3 package for simulating quantum error correction using stabilizer codes.
It provides access to all features via a command-line interface. It can also be used as a library via the fully-documented API. It includes many common codes, error models and decoders, and can be extended with additional components.
Install and upgrade using pip:
$ pip install -U qecsim
$ qecsim --version
qecsim, version 1.0b9
$ qecsim --help # console script
...
$ python -O -m qecsim --help # module script with Python options e.g. -O for optimize
...
>>> import qecsim
>>> qecsim.__version__
'1.0b9'
>>> from qecsim import app
>>> help(app)
...
qecsim can be extended with additional codes, error models and decoders that integrate into the command-line interface. See https://github.com/qecsim/qecsimext for a basic example.
qecsim is released under the BSD 3-Clause license. If you use qecsim in your research, please see the qecsim documentation for citing details.
- Source code: https://github.com/qecsim/qecsim
- Documentation: https://qecsim.github.io/
- Issue tracker: https://github.com/qecsim/qecsim/issues
- Releases: https://pypi.org/project/qecsim/
- Contact: [email protected]
Copyright 2016 - 2021, David K. Tuckett.