codedistance 0.0.4__tar.gz → 0.0.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- codedistance-0.0.6/LICENSE +21 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/PKG-INFO +11 -3
- {codedistance-0.0.4 → codedistance-0.0.6}/README.md +10 -2
- codedistance-0.0.6/codedistance/.DS_Store +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/codedistance/NHow.py +6 -1
- {codedistance-0.0.4 → codedistance-0.0.6}/codedistance/distance.py +107 -16
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/.DS_Store +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/exampleCSS.py +5 -11
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/exampleCircuit.py +1 -0
- codedistance-0.0.6/examples/exampleCodeDecomp.py +54 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/exampleQECC.py +1 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/runTest.py +2 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/pyproject.toml +1 -1
- codedistance-0.0.4/LICENSE +0 -674
- codedistance-0.0.4/codedistance/.DS_Store +0 -0
- codedistance-0.0.4/examples/results/bivariate_bicycle-QDistEvol-20260303_210332.141939_85062422.txt +0 -45
- codedistance-0.0.4/examples/results/codeTables-GF2_sample.txt-MeetMiddleMW-20260304_083616.219679_85062422.txt +0 -56
- codedistance-0.0.4/examples/results/codeTables-GF2_sample.txt-qubitserfBZ-20260304_083638.643376_85062422.txt +0 -113
- codedistance-0.0.4/examples/results/codeTables-QECC_sample.txt-DistRndGAP-20260303_211748.394245_85062422.txt +0 -41
- codedistance-0.0.4/examples/results/codeTables-QECC_sample.txt-GurobiDist-20260303_211844.251513_85062422.txt +0 -36
- codedistance-0.0.4/examples/results/codeTables-QECC_sample.txt-GurobiDist-20260303_211911.716534_85062422.txt +0 -62
- codedistance-0.0.4/examples/results/codeTables-QECC_sample.txt-MIPDist-SCIP-20260303_211946.657395_85062422.txt +0 -55
- codedistance-0.0.4/examples/results/codeTables-QECC_sample.txt-MeetMiddleMW-20260303_212209.934872_85062422.txt +0 -62
- codedistance-0.0.4/examples/results/codeTables-QECC_sample.txt-QDistRndMW-20260303_211826.240534_85062422.txt +0 -45
- codedistance-0.0.4/examples/results/codeTables-QECC_sample.txt-UndetectableErrorStim-20260303_212112.912496_85062422.txt +0 -60
- codedistance-0.0.4/examples/results/codeTables-QECC_sample.txt-connectedClusterMW-20260303_212134.502322_85062422.txt +0 -53
- codedistance-0.0.4/examples/results/codeTables-QECC_sample.txt-decoderDist-bposd-20260303_212055.599668_85062422.txt +0 -45
- codedistance-0.0.4/examples/results/codeTables-QECC_sample.txt-dist_m4ri_CC-20260303_210717.918454_85062422.txt +0 -36
- codedistance-0.0.4/examples/results/codeTables-QECC_sample.txt-dist_m4ri_CC-20260303_210957.256357_85062422.txt +0 -36
- codedistance-0.0.4/examples/results/codeTables-QECC_sample.txt-dist_m4ri_CC-20260303_211603.125645_85062422.txt +0 -65
- codedistance-0.0.4/examples/results/codeTables-QECC_sample.txt-dist_m4ri_RW-20260303_211225.834639_85062422.txt +0 -36
- codedistance-0.0.4/examples/results/codeTables-QECC_sample.txt-dist_m4ri_RW-20260303_211438.341279_85062422.txt +0 -36
- codedistance-0.0.4/examples/results/codeTables-QECC_sample.txt-dist_m4ri_RW-20260303_211500.216780_85062422.txt +0 -36
- codedistance-0.0.4/examples/results/codeTables-QECC_sample.txt-dist_m4ri_RW-20260303_211534.542039_85062422.txt +0 -96
- codedistance-0.0.4/examples/results/codeTables-QECC_sample.txt-magmaMinWeight-20260303_211626.143623_85062422.txt +0 -70
- codedistance-0.0.4/examples/results/codeTables-QECC_sample.txt-pySATDist-20260303_212037.393486_85062422.txt +0 -54
- codedistance-0.0.4/examples/results/codeTables-QECC_sample.txt-qubitserfBZ-20260303_212154.339830_85062422.txt +0 -47
- codedistance-0.0.4/examples/results/stim_circuit-01_surfacecodes-dist_m4ri_RW-20260304_085623.931043_85062422.txt +0 -41
- {codedistance-0.0.4 → codedistance-0.0.6}/codedistance/__init__.py +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/codedistance/code_library.py +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/codedistance/common.py +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/codedistance/complex_utils.py +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/codedistance/dem_detector_filtering.py +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/BB_codes.py +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/QT_codes.py +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/__init__.py +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/bivariate_bicycle.py +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/codeTables/.DS_Store +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/codeTables/GF2_32.txt +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/codeTables/GF2_64.txt +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/codeTables/GF2_sample.txt +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/codeTables/QECC_32.txt +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/codeTables/QECC_64.txt +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/codeTables/QECC_sample.txt +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/hyperbolic_codes/.DS_Store +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/hyperbolic_codes/RG-3-10.txt +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/hyperbolic_codes/RG-3-12.txt +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/hyperbolic_codes/RG-3-8.txt +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/lifted_product.py +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/runDistanceTest.sh +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/.DS_Store +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/01_surfacecodes/.DS_Store +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/01_surfacecodes/01_r=3,d=3,p=0.0005,noise=si1000,c=surface_code_Z,q=17,gates=cz.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/01_surfacecodes/02_r=5,d=5,p=0.0005,noise=si1000,c=surface_code_Z,q=49,gates=cz.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/01_surfacecodes/03_r=7,d=7,p=0.0005,noise=si1000,c=surface_code_Z,q=97,gates=cz.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/01_surfacecodes/04_r=9,d=9,p=0.0005,noise=si1000,c=surface_code_Z,q=161,gates=cz.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/01_surfacecodes/05_r=11,d=11,p=0.0005,noise=si1000,c=surface_code_Z,q=241,gates=cz.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/03_colorcodes_midout/01_r=3,d=3,p=0.0005,noise=uniform,c=midout_color_code_Z,q=9,gates=all.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/03_colorcodes_midout/02_r=5,d=5,p=0.0005,noise=uniform,c=midout_color_code_Z,q=23,gates=all.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/03_colorcodes_midout/03_r=7,d=7,p=0.0005,noise=uniform,c=midout_color_code_Z,q=43,gates=all.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/03_colorcodes_midout/04_r=9,d=9,p=0.0005,noise=uniform,c=midout_color_code_Z,q=69,gates=all.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/03_colorcodes_midout/05_r=11,d=11,p=0.0005,noise=uniform,c=midout_color_code_Z,q=101,gates=all.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/04_colorcodes_superdense/01_r=3,d=3,p=0.0005,noise=uniform,c=superdense_color_code_Z,q=13,gates=all.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/04_colorcodes_superdense/02_r=5,d=5,p=0.0005,noise=uniform,c=superdense_color_code_Z,q=37,gates=all.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/04_colorcodes_superdense/03_r=7,d=7,p=0.0005,noise=uniform,c=superdense_color_code_Z,q=73,gates=all.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/04_colorcodes_superdense/04_r=9,d=9,p=0.0005,noise=uniform,c=superdense_color_code_Z,q=121,gates=all.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/04_colorcodes_superdense/05_r=11,d=11,p=0.0005,noise=uniform,c=superdense_color_code_Z,q=181,gates=all.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/04_colorcodes_superdense/06_r=1,d=15,p=0.161473,noise=data_qubit_X,c=color_code_mpp,q=169,gates=mpp.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/05_bivariatebicyclecodes/.DS_Store +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/05_bivariatebicyclecodes/01_r=6,d=6,p=0.009,noise=si1000,c=bivariate_bicycle_Z,nkd=[[72,12,6]],q=144,iscolored=True,A_poly=x^3+y+y^2,B_poly=y^3+x+x^2.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/05_bivariatebicyclecodes/02_r=10,d=10,p=0.009,noise=si1000,c=bivariate_bicycle_Z,nkd=[[90,8,10]],q=180,iscolored=True,A_poly=x^9+y+y^2,B_poly=x^7+1+x^2.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/05_bivariatebicyclecodes/03_r=10,d=10,p=0.009,noise=si1000,c=bivariate_bicycle_Z,nkd=[[108,8,10]],q=216,iscolored=True,A_poly=x^3+y+y^2,B_poly=y^3+x+x^2.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/05_bivariatebicyclecodes/04_r=12,d=12,p=0.009,noise=si1000,c=bivariate_bicycle_Z,nkd=[[144,12,12]],q=288,iscolored=True,A_poly=x^3+y+y^2,B_poly=y^3+x+x^2.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/05_bivariatebicyclecodes/05_r=18,d=18,p=0.009,noise=si1000,c=bivariate_bicycle_Z,nkd=[[288,12,18]],q=576,iscolored=True,A_poly=x^3+y^2+y^7,B_poly=y^3+x+x^2.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/05_bivariatebicyclecodes/06_r=24,d=24,p=0.009,noise=si1000,c=bivariate_bicycle_Z,nkd=[[360,12,24]],q=720,iscolored=True,A_poly=x^9+y+y^2,B_poly=y^3+x^25+x^26.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/05_bivariatebicyclecodes/07_r=34,d=34,p=0.009,noise=si1000,c=bivariate_bicycle_Z,nkd=[[756,16,34]],q=1512,iscolored=True,A_poly=x^3+y^10+y^17,B_poly=y^5+x^3+x^19.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/06_bivariatebicyclecodes_nlr5wb/.DS_Store +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/06_bivariatebicyclecodes_nlr5wb/01_r=6,d=6,p=0.009,noise=nlr5wb,c=bivariate_bicycle_Z,k=12,q=144,iscolored=True,A_poly=x^3+y+y^2,B_poly=y^3+x+x^2.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/06_bivariatebicyclecodes_nlr5wb/02_r=10,d=10,p=0.009,noise=nlr5wb,c=bivariate_bicycle_Z,k=8,q=180,iscolored=True,A_poly=x^9+y+y^2,B_poly=x^7+1+x^2.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/06_bivariatebicyclecodes_nlr5wb/03_r=10,d=10,p=0.009,noise=nlr5wb,c=bivariate_bicycle_Z,k=8,q=216,iscolored=True,A_poly=x^3+y+y^2,B_poly=y^3+x+x^2.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/06_bivariatebicyclecodes_nlr5wb/04_r=12,d=12,p=0.009,noise=nlr5wb,c=bivariate_bicycle_Z,k=12,q=288,iscolored=True,A_poly=x^3+y+y^2,B_poly=y^3+x+x^2.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/06_bivariatebicyclecodes_nlr5wb/05_r=18,d=18,p=0.009,noise=nlr5wb,c=bivariate_bicycle_Z,k=12,q=576,iscolored=True,A_poly=x^3+y^2+y^7,B_poly=y^3+x+x^2.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/06_bivariatebicyclecodes_nlr5wb/06_r=24,d=24,p=0.009,noise=nlr5wb,c=bivariate_bicycle_Z,k=12,q=720,iscolored=True,A_poly=x^9+y+y^2,B_poly=y^3+x^25+x^26.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/06_bivariatebicyclecodes_nlr5wb/07_r=34,d=34,p=0.009,noise=nlr5wb,c=bivariate_bicycle_Z,k=16,q=1512,iscolored=True,A_poly=x^3+y^10+y^17,B_poly=y^5+x^3+x^19.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/07_bivariatebicyclecodes_nlr10wb/.DS_Store +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/07_bivariatebicyclecodes_nlr10wb/01_r=6,d=6,p=0.009,noise=nlr10wb,c=bivariate_bicycle_Z,k=12,q=144,iscolored=True,A_poly=x^3+y+y^2,B_poly=y^3+x+x^2.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/07_bivariatebicyclecodes_nlr10wb/02_r=10,d=10,p=0.009,noise=nlr10wb,c=bivariate_bicycle_Z,k=8,q=180,iscolored=True,A_poly=x^9+y+y^2,B_poly=x^7+1+x^2.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/07_bivariatebicyclecodes_nlr10wb/03_r=10,d=10,p=0.009,noise=nlr10wb,c=bivariate_bicycle_Z,k=8,q=216,iscolored=True,A_poly=x^3+y+y^2,B_poly=y^3+x+x^2.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/07_bivariatebicyclecodes_nlr10wb/04_r=12,d=12,p=0.009,noise=nlr10wb,c=bivariate_bicycle_Z,k=12,q=288,iscolored=True,A_poly=x^3+y+y^2,B_poly=y^3+x+x^2.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/07_bivariatebicyclecodes_nlr10wb/05_r=18,d=18,p=0.009,noise=nlr10wb,c=bivariate_bicycle_Z,k=12,q=576,iscolored=True,A_poly=x^3+y^2+y^7,B_poly=y^3+x+x^2.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/07_bivariatebicyclecodes_nlr10wb/06_r=24,d=24,p=0.009,noise=nlr10wb,c=bivariate_bicycle_Z,k=12,q=720,iscolored=True,A_poly=x^9+y+y^2,B_poly=y^3+x^25+x^26.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/07_bivariatebicyclecodes_nlr10wb/07_r=34,d=34,p=0.009,noise=nlr10wb,c=bivariate_bicycle_Z,k=16,q=1512,iscolored=True,A_poly=x^3+y^10+y^17,B_poly=y^5+x^3+x^19.stim +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/stim_circuits/README.md +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/.DS_Store +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_108_2_12.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_144_2_13.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_180_2_17.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_216_4_18.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_252_2_21.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_288_2_24.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_324_4_25.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_360_4_24.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_36_8_4.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_396_4_26.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_432_8_33.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_468_4_31.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_496_2_32.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_504_2_45.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_540_4_40.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_576_2_57.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_576_2_59.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_612_2_52.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_648_10_71.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_648_14_50.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_684_2_29.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HX_72_8_8.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_108_2_12.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_144_2_13.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_180_2_17.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_216_4_18.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_252_2_21.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_288_2_24.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_324_4_25.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_360_4_24.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_36_8_4.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_396_4_26.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_432_8_33.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_468_4_31.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_496_2_32.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_504_2_45.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_540_4_40.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_576_2_57.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_576_2_59.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_612_2_52.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_648_10_71.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_648_14_50.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_684_2_29.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tanner_codes/HZ_72_8_8.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tmp/20260303_211550.461468_85062422H.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tmp/20260303_211550.461468_85062422L.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tmp/20260303_211550.463575_44088179.stdout +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tmp/20260303_211609.373972_85062422H.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tmp/20260303_211609.373972_85062422L.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tmp/20260303_211609.375508_00717477.stdout +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tmp/20260303_211632.978435_00404018.stdout +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tmp/20260303_211807.002810_13674611.g +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tmp/20260303_211807.002810_13674611H.mtx +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tmp/20260303_211807.003731_32355872.stdout +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tmp/20260303_212039.803682_85062422.wcnf +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tmp/20260303_212039.804165_58423964.stdout +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tmp/20260303_212158.101738_32352392.stderr +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tmp/20260303_212158.101738_32352392.stdout +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tmp/20260304_083641.372186_71140661.stderr +0 -0
- {codedistance-0.0.4 → codedistance-0.0.6}/examples/tmp/20260304_083641.372186_71140661.stdout +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mark Alan Webster, Abraham Jacob, Oscar Higgott
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codedistance
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.6
|
|
4
4
|
Summary: Code and Circuit Distance Algorithms.
|
|
5
5
|
License: GNUv3
|
|
6
6
|
License-File: LICENSE
|
|
@@ -42,7 +42,13 @@ Distance algorithms for classical codes, quantum codes and quantum circuits
|
|
|
42
42
|
Mark Webster, Abe Jacob and Oscar Higgott
|
|
43
43
|
|
|
44
44
|
# Installation
|
|
45
|
-
To install the python library, use
|
|
45
|
+
To install the python library, use
|
|
46
|
+
|
|
47
|
+
pip install codedistance
|
|
48
|
+
|
|
49
|
+
If you wish to make changes to the source code or run the examples from the package, you can also download the codebase from the [github page](https://github.com/m-webster/codeDistancePYPI), create a virtual environment, navigate to the local copy of the codebase and run:
|
|
50
|
+
|
|
51
|
+
pip install -e .
|
|
46
52
|
|
|
47
53
|
Certain distance-finding algorithms require installation of external packages:
|
|
48
54
|
|
|
@@ -52,6 +58,8 @@ Certain distance-finding algorithms require installation of external packages:
|
|
|
52
58
|
4. CLISATDist: requies a SAT solver binary on the system path - by default this is cashwmaxsatcoreplus which runs only on Unix systems and is available from https://maxsat-evaluations.github.io/2023
|
|
53
59
|
5. qubitserfBZ and qubitserfMM: requires compiliation of the C library from https://github.com/qubitserfed/Qubitserf. By default, this results in an executable called "interface". This binary should be renamed qubitserf and be accessible on the system path
|
|
54
60
|
|
|
61
|
+
To compile on a Windows machine we recommend using Cygwin with the packages listed [here](https://www.codefull.net/2015/12/essential-cygwin-development-packages/).
|
|
62
|
+
|
|
55
63
|
|
|
56
64
|
# Main Distance-Finding Functions
|
|
57
65
|
The package finds distances of classical codes, CSS quantum codes, non-CSS quantum codes and quantum circuits.
|
|
@@ -136,7 +144,7 @@ As each dataset may have many codes/circuits, the recommended way to run these i
|
|
|
136
144
|
The distance-finding results for the data set are saved in a text file within the examples/results folder.
|
|
137
145
|
For example, to find distances of the non-CSS codetables dataset using the QDistEvol function, open a terminal window, navigate/change directory to the examples folder then run the following command via a terminal:
|
|
138
146
|
|
|
139
|
-
python3 runTest.py --dataset codeTables --datafile QECC_sample.txt --method QDistEvol
|
|
147
|
+
python3 runTest.py --dataset codeTables --datafile QECC_sample.txt --method QDistEvol
|
|
140
148
|
|
|
141
149
|
# Parameters for Distance-Finding Methods
|
|
142
150
|
Here we lay out the main parameter settings used for various distance-finding methods:
|
|
@@ -5,7 +5,13 @@ Distance algorithms for classical codes, quantum codes and quantum circuits
|
|
|
5
5
|
Mark Webster, Abe Jacob and Oscar Higgott
|
|
6
6
|
|
|
7
7
|
# Installation
|
|
8
|
-
To install the python library, use
|
|
8
|
+
To install the python library, use
|
|
9
|
+
|
|
10
|
+
pip install codedistance
|
|
11
|
+
|
|
12
|
+
If you wish to make changes to the source code or run the examples from the package, you can also download the codebase from the [github page](https://github.com/m-webster/codeDistancePYPI), create a virtual environment, navigate to the local copy of the codebase and run:
|
|
13
|
+
|
|
14
|
+
pip install -e .
|
|
9
15
|
|
|
10
16
|
Certain distance-finding algorithms require installation of external packages:
|
|
11
17
|
|
|
@@ -15,6 +21,8 @@ Certain distance-finding algorithms require installation of external packages:
|
|
|
15
21
|
4. CLISATDist: requies a SAT solver binary on the system path - by default this is cashwmaxsatcoreplus which runs only on Unix systems and is available from https://maxsat-evaluations.github.io/2023
|
|
16
22
|
5. qubitserfBZ and qubitserfMM: requires compiliation of the C library from https://github.com/qubitserfed/Qubitserf. By default, this results in an executable called "interface". This binary should be renamed qubitserf and be accessible on the system path
|
|
17
23
|
|
|
24
|
+
To compile on a Windows machine we recommend using Cygwin with the packages listed [here](https://www.codefull.net/2015/12/essential-cygwin-development-packages/).
|
|
25
|
+
|
|
18
26
|
|
|
19
27
|
# Main Distance-Finding Functions
|
|
20
28
|
The package finds distances of classical codes, CSS quantum codes, non-CSS quantum codes and quantum circuits.
|
|
@@ -99,7 +107,7 @@ As each dataset may have many codes/circuits, the recommended way to run these i
|
|
|
99
107
|
The distance-finding results for the data set are saved in a text file within the examples/results folder.
|
|
100
108
|
For example, to find distances of the non-CSS codetables dataset using the QDistEvol function, open a terminal window, navigate/change directory to the examples folder then run the following command via a terminal:
|
|
101
109
|
|
|
102
|
-
python3 runTest.py --dataset codeTables --datafile QECC_sample.txt --method QDistEvol
|
|
110
|
+
python3 runTest.py --dataset codeTables --datafile QECC_sample.txt --method QDistEvol
|
|
103
111
|
|
|
104
112
|
# Parameters for Distance-Finding Methods
|
|
105
113
|
Here we lay out the main parameter settings used for various distance-finding methods:
|
|
Binary file
|
|
@@ -450,7 +450,12 @@ def HowPivots(A,nA=0,tB=1,nC=-1,r0=0):
|
|
|
450
450
|
# @nb.jit
|
|
451
451
|
# @nb.jit(nb.types.Tuple((nb.int8[:,:],nb.int64[:]))(nb.int8[:,:],nb.int64,nb.int64,nb.int64,nb.int64))
|
|
452
452
|
|
|
453
|
-
|
|
453
|
+
def indepVecs(A):
|
|
454
|
+
"""Return a linearly independent subset of rows from A, preserving priority order - uses only 2 RREF calls."""
|
|
455
|
+
H, U = getHU(A, 2)
|
|
456
|
+
K = U[np.sum(H, axis=-1) == 0, :]
|
|
457
|
+
K, LI = getH(K, 2, retPivots=True)
|
|
458
|
+
return invRange(len(A), LI)
|
|
454
459
|
|
|
455
460
|
def indepL(L,pList,nA,tB,retWeights=False):
|
|
456
461
|
w = np.sum(L[:,-nA:],axis=-1)
|
|
@@ -13,7 +13,7 @@ import ortools
|
|
|
13
13
|
import ortools.linear_solver
|
|
14
14
|
import ortools.linear_solver.pywraplp
|
|
15
15
|
import scipy
|
|
16
|
-
import tesseract_decoder as ts
|
|
16
|
+
# import tesseract_decoder as ts
|
|
17
17
|
|
|
18
18
|
## MW Library Files
|
|
19
19
|
from .common import *
|
|
@@ -30,6 +30,9 @@ def codeDistance(H,L=None,tB=1,method='QDistRndMW',params={},seed=None):
|
|
|
30
30
|
CSS codes: input H=HX and L=LX for Z-distance or H=HZ and L=LZ for X-distance, set tB=1
|
|
31
31
|
Classical binary linear codes: set S to be the generator matrix, tB=1 '''
|
|
32
32
|
H = Z2Mat(H)
|
|
33
|
+
# rWeights = rowWeight(H,tB)
|
|
34
|
+
# cWeights = np.sum(H,axis=0)
|
|
35
|
+
# print(f'H Row/Col weights: {set(map(int,rWeights))} {set(map(int,rWeights))}')
|
|
33
36
|
if L is not None:
|
|
34
37
|
L = Z2Mat(L)
|
|
35
38
|
r,n = H.shape
|
|
@@ -207,6 +210,36 @@ def pauli2str(S,tB=2):
|
|
|
207
210
|
PauliStrings = "IXZY"
|
|
208
211
|
return "\n".join(["".join([PauliStrings[a] for a in myrow]) for myrow in S])
|
|
209
212
|
|
|
213
|
+
|
|
214
|
+
def codeDecomp(S,tB=2):
|
|
215
|
+
'''Separate stabiliser code into indecomposable parts using method of Slepian, 1960'''
|
|
216
|
+
H = getH(S,N=2,tB=2)
|
|
217
|
+
H1 = mod1(ZMatBlockSum(H,tB=tB))
|
|
218
|
+
m,n = H1.shape
|
|
219
|
+
partitions = []
|
|
220
|
+
rSet = set(range(m))
|
|
221
|
+
cSet = set(range(n))
|
|
222
|
+
while len(rSet) > 0:
|
|
223
|
+
r = min(rSet)
|
|
224
|
+
cVisited = set()
|
|
225
|
+
rVisited = {r}
|
|
226
|
+
rTodo = [r]
|
|
227
|
+
while(len(rTodo) > 0):
|
|
228
|
+
r = rTodo.pop()
|
|
229
|
+
for c in bin2Set(H1[r]):
|
|
230
|
+
if c not in cVisited:
|
|
231
|
+
cVisited.add(c)
|
|
232
|
+
for r in bin2Set(H1[:,c]):
|
|
233
|
+
if r not in rVisited:
|
|
234
|
+
rTodo.append(r)
|
|
235
|
+
rVisited.add(r)
|
|
236
|
+
if tB == 2:
|
|
237
|
+
cVisited.update({n+c for c in cVisited})
|
|
238
|
+
partitions.append(list(cVisited))
|
|
239
|
+
rSet.difference_update(rVisited)
|
|
240
|
+
cSet.difference_update(cVisited)
|
|
241
|
+
return partitions
|
|
242
|
+
|
|
210
243
|
def defaultLogicals(S,tB):
|
|
211
244
|
'''Return defaul logical operators for distance-finding
|
|
212
245
|
For tB=1 - classical code - return basis of complementary space
|
|
@@ -676,6 +709,12 @@ def grayCode(x):
|
|
|
676
709
|
'''calculte Gray Code corresponding to integer x'''
|
|
677
710
|
return x ^ (x >> 1)
|
|
678
711
|
|
|
712
|
+
def bin2int(x):
|
|
713
|
+
"""Interpret a little-endian binary vector as an integer."""
|
|
714
|
+
## need to reverse to make consistent with int2bin
|
|
715
|
+
xStr = "".join(map(str, reversed(x)))
|
|
716
|
+
return int(xStr, base=2)
|
|
717
|
+
|
|
679
718
|
@nb.jit (nb.int8[:](nb.int64,nb.int64))
|
|
680
719
|
def int2bin(x,n):
|
|
681
720
|
'''convert integer to binary representation'''
|
|
@@ -1171,6 +1210,7 @@ def dist_m4ri_RW(S,L,tB=2,params={},seed=0):
|
|
|
1171
1210
|
|
|
1172
1211
|
def dist_m4ri_CC(S,L,tB=2,params={},seed=0):
|
|
1173
1212
|
'''Connected Cluster algorithm'''
|
|
1213
|
+
addI = False
|
|
1174
1214
|
if tB == 2:
|
|
1175
1215
|
## 2-block non-CSS code
|
|
1176
1216
|
if L is None:
|
|
@@ -1634,7 +1674,8 @@ def gurobiDist(S,L=None,tB=1,params={}):
|
|
|
1634
1674
|
'verbose': False,
|
|
1635
1675
|
'maxTime': 3600 * 8,
|
|
1636
1676
|
'nThreads': 1,
|
|
1637
|
-
'GF4blockRep': 2
|
|
1677
|
+
'GF4blockRep': 2,
|
|
1678
|
+
'LOCheck': 0
|
|
1638
1679
|
}
|
|
1639
1680
|
params = setDefaultParams(params,paramDefaults)
|
|
1640
1681
|
if L is None:
|
|
@@ -1727,7 +1768,8 @@ def MIPDist(DEMH,DEML=None,solverType='SCIP',params={}):
|
|
|
1727
1768
|
paramDefaults = {
|
|
1728
1769
|
'verbose': False,
|
|
1729
1770
|
'maxTime': 3600 * 8,
|
|
1730
|
-
'nThreads': 1
|
|
1771
|
+
'nThreads': 1,
|
|
1772
|
+
'LOCheck': 0
|
|
1731
1773
|
}
|
|
1732
1774
|
params = setDefaultParams(params,paramDefaults)
|
|
1733
1775
|
r,n = DEMH.shape
|
|
@@ -1909,6 +1951,21 @@ def parseSATResult(mytext):
|
|
|
1909
1951
|
## Decoder Methods
|
|
1910
1952
|
###########################################################
|
|
1911
1953
|
|
|
1954
|
+
def randomLO(H,L,params,rnd):
|
|
1955
|
+
## make a random non-trivial lo
|
|
1956
|
+
k,n = L.shape
|
|
1957
|
+
r = len(H)
|
|
1958
|
+
x = NonZeroVecRand(k)
|
|
1959
|
+
lo = Z2MatZeros(n)
|
|
1960
|
+
for j in bin2Set(x):
|
|
1961
|
+
lo ^= L[j]
|
|
1962
|
+
## add randomly generated set of stabilisers to lo
|
|
1963
|
+
if params['addStabs']:
|
|
1964
|
+
x = rnd.integers(2,size=r)
|
|
1965
|
+
for j in bin2Set(x):
|
|
1966
|
+
lo ^= H[j]
|
|
1967
|
+
return lo
|
|
1968
|
+
|
|
1912
1969
|
def decoderDist(H,L,params={},seed=None):
|
|
1913
1970
|
'''Distance via syndrome decoders
|
|
1914
1971
|
set maxErr to a value 0 < maxErr <= 1 to terminate when probability of error less than pErr'''
|
|
@@ -1920,10 +1977,14 @@ def decoderDist(H,L,params={},seed=None):
|
|
|
1920
1977
|
'maxErr':-1,
|
|
1921
1978
|
'priors':None,
|
|
1922
1979
|
'addStabs':0,
|
|
1923
|
-
'permuteDEM': 1
|
|
1980
|
+
'permuteDEM': 1,
|
|
1981
|
+
'randomLO': 1
|
|
1924
1982
|
}
|
|
1925
1983
|
params = setDefaultParams(params,paramDefaults)
|
|
1926
1984
|
k = len(L)
|
|
1985
|
+
## if params['randomLO'] == 0, then just try each of the k basis elements
|
|
1986
|
+
if params['randomLO'] == 0:
|
|
1987
|
+
params['iterCount'] = k
|
|
1927
1988
|
s = Z2Mat([0] * r + [1])
|
|
1928
1989
|
Hlo = ZMatVstack([H,Z2MatZeros((1,n))])
|
|
1929
1990
|
wDict = ZMatZeros(n+1)
|
|
@@ -1932,16 +1993,7 @@ def decoderDist(H,L,params={},seed=None):
|
|
|
1932
1993
|
best, minWords, minWordCount, nExp, pErr = mwUpdate(w,minRows)
|
|
1933
1994
|
ix = np.arange(n)
|
|
1934
1995
|
for TrialId in range(params['iterCount']):
|
|
1935
|
-
|
|
1936
|
-
x = NonZeroVecRand(k)
|
|
1937
|
-
lo = Z2MatZeros(n)
|
|
1938
|
-
for j in bin2Set(x):
|
|
1939
|
-
lo ^= L[j]
|
|
1940
|
-
## add randomly generated set of stabilisers to lo
|
|
1941
|
-
if params['addStabs']:
|
|
1942
|
-
x = rnd.integers(2,size=r)
|
|
1943
|
-
for j in bin2Set(x):
|
|
1944
|
-
lo ^= H[j]
|
|
1996
|
+
lo = randomLO(H,L,params,rnd) if params['randomLO'] else L[TrialId]
|
|
1945
1997
|
Hlo[-1] = lo
|
|
1946
1998
|
## find a correction
|
|
1947
1999
|
decoderType = params['decoder']
|
|
@@ -1954,6 +2006,8 @@ def decoderDist(H,L,params={},seed=None):
|
|
|
1954
2006
|
lo = bplsdDecode(Hlo[:,ix],s,params=params)
|
|
1955
2007
|
elif decoderType in {'tesseract','tesseractLongbeam'}:
|
|
1956
2008
|
lo = tesseractDecode(Hlo[:,ix],s,params=params)
|
|
2009
|
+
elif decoderType == 'simplex':
|
|
2010
|
+
lo = simplexDecode(Hlo[:,ix],s,params=params)
|
|
1957
2011
|
## reverse permutation for lo
|
|
1958
2012
|
if params['permuteDEM']:
|
|
1959
2013
|
lo = lo[ixRev(ix)]
|
|
@@ -2008,12 +2062,48 @@ def tesseractDecode(DEMH,s,params={},seed=0):
|
|
|
2008
2062
|
det_orders=det_orders,
|
|
2009
2063
|
)
|
|
2010
2064
|
decoder = ts.tesseract.TesseractDecoder(config)
|
|
2065
|
+
decoder = ts.simplex.SimplexDecoder(config)
|
|
2066
|
+
decoder.decode_to_errors(syndrome=np.array(s,dtype=bool))
|
|
2067
|
+
## Tesseract jumbles the order of the errors - need to restore order!!
|
|
2068
|
+
nErr = len(DEMH.T)
|
|
2069
|
+
DEMDict = {tuple(bin2Set(DEMH[:,i])):i for i in range(nErr)}
|
|
2070
|
+
errMap = ZMatZeros(nErr)
|
|
2071
|
+
## decoder.errors are the errors and symptom.detector tells us which detectors they fire
|
|
2072
|
+
# print('error weight',len(decoder.predicted_errors_buffer),'low_confidence_flag',decoder.low_confidence_flag)
|
|
2073
|
+
|
|
2074
|
+
for i,myObj in enumerate(decoder.errors):
|
|
2075
|
+
errMap[i] = DEMDict[tuple(myObj.symptom.detectors)]
|
|
2076
|
+
return set2Bin(nErr,errMap[decoder.predicted_errors_buffer],dtype=np.int8)
|
|
2077
|
+
|
|
2078
|
+
|
|
2079
|
+
def simplexDecode(DEMH,s,params={},seed=0):
|
|
2080
|
+
'''apply simplex Decoder from tesseract distribution with DEM matrix DEMH and syndrome s'''
|
|
2081
|
+
StimDEM = Stabs2StimDEM(DEMH)
|
|
2082
|
+
defaultParams = {
|
|
2083
|
+
'parallelize':False,
|
|
2084
|
+
'window_length':0,
|
|
2085
|
+
'window_slide_length':0,
|
|
2086
|
+
'merge_errors':True
|
|
2087
|
+
}
|
|
2088
|
+
setDefaultParams(params, defaultParams)
|
|
2089
|
+
config = ts.simplex.SimplexConfig(
|
|
2090
|
+
dem=StimDEM,
|
|
2091
|
+
parallelize=params['parallelize'],
|
|
2092
|
+
window_length=params['window_length'],
|
|
2093
|
+
window_slide_length=params['window_slide_length'],
|
|
2094
|
+
merge_errors=params['merge_errors']
|
|
2095
|
+
)
|
|
2096
|
+
decoder = ts.simplex.SimplexDecoder(config)
|
|
2097
|
+
decoder.init_ilp()
|
|
2098
|
+
# print('init_ilp')
|
|
2011
2099
|
decoder.decode_to_errors(syndrome=np.array(s,dtype=bool))
|
|
2100
|
+
# print('decode_to_errors')
|
|
2012
2101
|
## Tesseract jumbles the order of the errors - need to restore order!!
|
|
2013
2102
|
nErr = len(DEMH.T)
|
|
2014
2103
|
DEMDict = {tuple(bin2Set(DEMH[:,i])):i for i in range(nErr)}
|
|
2015
|
-
errMap =
|
|
2104
|
+
errMap = ZMatZeros(nErr)
|
|
2016
2105
|
## decoder.errors are the errors and symptom.detector tells us which detectors they fire
|
|
2106
|
+
# print('error weight',len(decoder.predicted_errors_buffer))
|
|
2017
2107
|
for i,myObj in enumerate(decoder.errors):
|
|
2018
2108
|
errMap[i] = DEMDict[tuple(myObj.symptom.detectors)]
|
|
2019
2109
|
return set2Bin(nErr,errMap[decoder.predicted_errors_buffer],dtype=np.int8)
|
|
@@ -2074,7 +2164,8 @@ def dist_qubitserf(S,L=None,tB=1,params={}):
|
|
|
2074
2164
|
defaultParams={
|
|
2075
2165
|
'method':'qubitserfMM',
|
|
2076
2166
|
'maxTime' : 8 * 60 * 60,
|
|
2077
|
-
'nThreads' : 1
|
|
2167
|
+
'nThreads' : 1,
|
|
2168
|
+
'LOCheck': 0
|
|
2078
2169
|
}
|
|
2079
2170
|
method = 1 if params['method'] == 'qubitserfBZ' else 2
|
|
2080
2171
|
params = setDefaultParams(params,defaultParams)
|
|
Binary file
|
|
@@ -21,11 +21,12 @@ params = {
|
|
|
21
21
|
'iterCount': 10000, ## number of iterations - eg QDistRnd, decoderDist
|
|
22
22
|
'maxTime': 3600*8, ## max runtime for CLI methods (eg SAT, m4ri, )
|
|
23
23
|
'nThreads': 1, ## cater for multi-threaded methods
|
|
24
|
+
'LOCheck': 0 ## check logical operators
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
## Magma distance finding: requires Magma licence and magma executable in PATH
|
|
27
|
-
|
|
28
|
-
method = 'magmaMinWord'
|
|
28
|
+
method = 'magmaMinWeight'
|
|
29
|
+
# method = 'magmaMinWord'
|
|
29
30
|
# method = 'magmaWEDist'
|
|
30
31
|
|
|
31
32
|
## Serban Cercelescu C Library https://github.com/qubitserfed/Qubitserf
|
|
@@ -104,9 +105,9 @@ allMethods = ['magmaMinWeight',
|
|
|
104
105
|
'GraphLikeErrorMW',
|
|
105
106
|
'ColourCodeDistMW',
|
|
106
107
|
'decoderDist',
|
|
107
|
-
'GurobiDist',
|
|
108
108
|
'MIPDist',
|
|
109
|
-
'pySATDist'
|
|
109
|
+
'pySATDist',
|
|
110
|
+
'GurobiDist']
|
|
110
111
|
|
|
111
112
|
## Single Method
|
|
112
113
|
methods = [method]
|
|
@@ -122,11 +123,4 @@ for method in methods:
|
|
|
122
123
|
if (res['T'] > 1):
|
|
123
124
|
print(f'Total Trials: {res['T']}')
|
|
124
125
|
print(f'Trials at d={res['d']}: {res['R']}')
|
|
125
|
-
lo = res['L']
|
|
126
|
-
if (np.sum(lo)) > 0:
|
|
127
|
-
r1,V = HowRes(Hz,lo,2)
|
|
128
|
-
print(f'lo: {bin2Set(lo)}')
|
|
129
|
-
lo = ZMat2D(lo)
|
|
130
|
-
r2 = matMul(lo,Hx.T,2)
|
|
131
|
-
print(f'Logical Operator Check: commutes with stabilsers {np.sum(r2)==0}; non-trivial {np.sum(r1)!=0}')
|
|
132
126
|
print("###########################################\n")
|
|
@@ -15,6 +15,7 @@ params = {
|
|
|
15
15
|
'iterCount': 100, ## number of iterations - eg QDistRnd, decoderDist
|
|
16
16
|
'maxTime': 3600*8, ## max runtime for CLI methods (eg SAT, m4ri, )
|
|
17
17
|
'nThreads': 1, ## cater for multi-threaded methods
|
|
18
|
+
'LOCheck': 0 ## check logical operators
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
## Magma distance finding: requires Magma licence and magma executable in PATH
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from codedistance import *
|
|
3
|
+
|
|
4
|
+
## Illustrate Decomposition of Codes into Direct Sums - Slepian, 1960
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## Eberhardt108
|
|
8
|
+
n,k,d = 108,16,6
|
|
9
|
+
l,m,ALen = 6,9,3
|
|
10
|
+
uVec = '0 0 0 0 2 4'
|
|
11
|
+
vVec = '0 1 2 3 0 0'
|
|
12
|
+
|
|
13
|
+
## Eberhardt128
|
|
14
|
+
n,k,d = 128,14,12
|
|
15
|
+
l,m,ALen = 8,8,4
|
|
16
|
+
uVec = '2 0 0 0 0 1 3 4'
|
|
17
|
+
vVec = '0 1 3 4 2 0 0 0'
|
|
18
|
+
|
|
19
|
+
## Eberhardt162-4
|
|
20
|
+
n,k,d = 162,4,16
|
|
21
|
+
l,m,ALen = 9,9,3
|
|
22
|
+
uVec = '0 1 0 3 0 0'
|
|
23
|
+
vVec = '0 0 1 0 1 2'
|
|
24
|
+
|
|
25
|
+
## Eberhardt162-12
|
|
26
|
+
n,k,d = 162,12,8
|
|
27
|
+
l,m,ALen = 9,9,3
|
|
28
|
+
uVec = '0 1 0 0 2 3'
|
|
29
|
+
vVec = '0 0 6 3 0 0'
|
|
30
|
+
|
|
31
|
+
## Eberhardt162-24
|
|
32
|
+
n,k,d = 162,24,6
|
|
33
|
+
l,m,ALen = 9,9,3
|
|
34
|
+
uVec = '0 0 0 0 3 6'
|
|
35
|
+
vVec = '0 1 2 3 0 0'
|
|
36
|
+
|
|
37
|
+
uVec = list(map(int,uVec.split(" ")))
|
|
38
|
+
vVec = list(map(int,vVec.split(" ")))
|
|
39
|
+
SX,SZ = BBCSSCode(l,m,uVec,vVec,ALen)
|
|
40
|
+
qubitPartitions = codeDecomp(ZMatVstack([SX,SZ]))
|
|
41
|
+
if len(qubitPartitions) == 1:
|
|
42
|
+
print('No partitions found')
|
|
43
|
+
else:
|
|
44
|
+
print(f'{len(qubitPartitions)} partitions found')
|
|
45
|
+
for i,ix in enumerate(qubitPartitions):
|
|
46
|
+
ix = sorted(ix)
|
|
47
|
+
print(f'Subcode {i}:',ix)
|
|
48
|
+
print('SX')
|
|
49
|
+
print(ZMatPrint(RemoveZeroRows(SX[:,ix])))
|
|
50
|
+
print('SZ')
|
|
51
|
+
print(ZMatPrint(RemoveZeroRows(SZ[:,ix])))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
@@ -36,6 +36,7 @@ params = {
|
|
|
36
36
|
'iterCount': 100, ## number of iterations - eg QDistRnd, decoderDist
|
|
37
37
|
'maxTime': 3600*8, ## max runtime for CLI methods (eg SAT, m4ri, )
|
|
38
38
|
'nThreads': 1, ## cater for multi-threaded methods
|
|
39
|
+
'LOCheck': 0 ## check logical operators
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
## Magma distance finding: requires Magma licence and magma executable in PATH
|
|
@@ -69,6 +69,8 @@ def defaultParser():
|
|
|
69
69
|
parser.add_argument("--decoder", help="Type of decoder - for decoderDist only. Options are bposd, bplsd, sebplsd, tesseract, tesseractLongbeam",type=str, default='bposd')
|
|
70
70
|
parser.add_argument("--addStabs",help="Add stabilisers to randomly generated error",type=int,default=0)
|
|
71
71
|
parser.add_argument("--permuteDEM",help="Apply random permutation to columns of DEM",type=int,default=1)
|
|
72
|
+
parser.add_argument("--randomLO",help="Generate random LO",type=int,default=1)
|
|
73
|
+
|
|
72
74
|
|
|
73
75
|
## method=='decoderDist' and decoder in {'bposd','bplsd','sebplsd'} only
|
|
74
76
|
## product_sum good for code capacity, bad for circuit level noise - don't have sparse matrices in this case
|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[tool.poetry]
|
|
6
6
|
name = "codedistance"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.6"
|
|
8
8
|
description = "Code and Circuit Distance Algorithms."
|
|
9
9
|
license = "GNUv3"
|
|
10
10
|
authors = ["Mark Webster <mark.acacia@gmail.com>","Abraham Jacob <abraham.jacob.17@ucl.ac.uk>","Oscar Higgott <oscarhiggott@google.com>"]
|