diff --git a/data/surface_code_rotated_memory_x_13_0.01_1000_shots_no_buckets_predictions_pymatchingv2.2.2_correlated.txt b/data/surface_code_rotated_memory_x_13_0.01_1000_shots_no_buckets_predictions_pymatching_correlated.txt similarity index 99% rename from data/surface_code_rotated_memory_x_13_0.01_1000_shots_no_buckets_predictions_pymatchingv2.2.2_correlated.txt rename to data/surface_code_rotated_memory_x_13_0.01_1000_shots_no_buckets_predictions_pymatching_correlated.txt index 513b2af65..d64da42a6 100644 --- a/data/surface_code_rotated_memory_x_13_0.01_1000_shots_no_buckets_predictions_pymatchingv2.2.2_correlated.txt +++ b/data/surface_code_rotated_memory_x_13_0.01_1000_shots_no_buckets_predictions_pymatching_correlated.txt @@ -169,7 +169,7 @@ 1 0 0 -1 +0 0 1 0 @@ -813,7 +813,7 @@ 1 1 1 -1 +0 0 0 1 diff --git a/data/surface_code_rotated_memory_x_13_0.01_1000_shots_no_buckets_weights_pymatching_correlated.txt b/data/surface_code_rotated_memory_x_13_0.01_1000_shots_no_buckets_weights_pymatching_correlated.txt new file mode 100644 index 000000000..e78816b69 --- /dev/null +++ b/data/surface_code_rotated_memory_x_13_0.01_1000_shots_no_buckets_weights_pymatching_correlated.txt @@ -0,0 +1,1000 @@ +311.72786034888975 +352.5969147261106 +420.70768120786505 +361.12397567659474 +426.6261559816895 +345.7056455998233 +420.89880711463684 +312.34992795912143 +388.08705560652476 +452.8687660162192 +386.6793170616448 +407.697448965172 +400.2944517430124 +348.18263001015947 +401.8524865718622 +383.339050843926 +404.88536587310284 +437.5242197409508 +370.36705507708876 +368.1422977087399 +395.656501308611 +386.19613017097873 +402.08603568500223 +446.0775082886064 +456.69736800546025 +309.0187707568354 +378.06143561305464 +366.78893548231156 +352.84159068796106 +382.4017071079416 +294.4461680085421 +414.77696001787217 +312.7775201369901 +210.64203304459792 +422.0268560372133 +465.4490240000936 +358.1624617417306 +337.5702610184502 +358.27212676258057 +432.71034968123655 +367.65886551562005 +396.23436824030614 +435.8037608042282 +401.99697077596795 +336.03849543524603 +331.12388618741903 +360.30824548515255 +375.43101151780917 +407.9652479481033 +393.8619070290272 +341.07106092685893 +334.2511169302867 +373.28352548124434 +407.73079845142445 +440.8508245532394 +444.04309185917737 +318.02825868980887 +368.3285638033024 +361.3660835511743 +335.03954548805865 +400.0687261898571 +423.20776710913856 +411.27107687789714 +370.9067310638871 +309.87902140238697 +375.09895705717463 +388.50547382557716 +400.9882419082295 +388.03339966549476 +352.04676379510823 +373.34006999102445 +374.5934165833402 +422.163542799869 +366.190601149193 +359.4290225478092 +414.42866371117543 +372.9476601852243 +393.30489821791554 +313.68522251273475 +409.12158042007127 +389.4535194546543 +424.7400070614044 +421.2880466950565 +343.6003748802091 +420.01692114561956 +368.72781666517864 +342.06765738230314 +365.250514261165 +403.2637617075139 +387.1780776580207 +381.4039289652814 +390.24055455330785 +391.02602289283607 +371.971525836906 +351.46316455096564 +409.75070638781324 +406.6726508454719 +439.8192744393813 +337.5395064439097 +303.63276396015453 +408.29202328816166 +437.9997584893581 +397.88105925841836 +349.98135701842057 +410.59173308596223 +345.8029272586746 +334.2311408396771 +476.19924732354764 +385.4585042808037 +363.7141856993682 +376.02300822379226 +372.5602097244276 +344.34866030909643 +311.9476887604668 +368.196557199692 +368.93383260736834 +419.87837961405114 +362.78320782677304 +314.65009765490356 +365.93929213840306 +316.36379012638815 +403.7427308077885 +338.81648148624686 +407.32459947114626 +365.9197410034111 +367.3910922982702 +366.29605508576174 +456.5581886875121 +415.6485634021636 +371.22800209924634 +389.5236657207788 +298.91799573879354 +337.86580353242164 +373.72224239010455 +386.1701157575225 +402.7749046241584 +429.87025481371745 +396.15660100931706 +386.3067344002162 +371.9058687821613 +407.1439280372946 +406.1623327975171 +371.2163595859533 +404.9151081779494 +369.1532237099667 +349.0816553851524 +389.0864446274566 +375.3250140333574 +395.2963503637655 +389.39526912219964 +356.95538589829835 +354.1922030562354 +267.74034576214325 +349.3418422270483 +279.97202507678423 +326.7095474696328 +327.99254283420487 +454.90215746964014 +442.4236661205588 +354.0825761543279 +359.8820933562208 +423.96345043648654 +415.1849590593216 +333.84788522731566 +384.2520891657073 +420.8807528540424 +420.55781587971677 +293.93473639333325 +495.41412277077245 +374.52903510135496 +287.8005747604383 +394.70995184802496 +361.70753927246716 +356.3990896996387 +363.4088745004877 +372.026272756187 +375.91983965900465 +406.9161602970928 +325.6431559364691 +351.3322404547301 +362.13763882966146 +336.7067836750109 +380.79948889526065 +442.15695211567464 +410.8013798574203 +342.5867759646195 +389.78894461807033 +293.47304152714554 +463.7394060200131 +374.24148768260926 +351.79976716615954 +358.136045667566 +405.16841419777995 +314.1043342847679 +313.1660926359169 +364.93253910251497 +373.89448177270503 +399.91157979074774 +311.0721248886455 +370.2090901795762 +435.59812746327566 +302.35962410697164 +376.0923532862189 +384.03221169363945 +368.60005255868157 +414.75300155663604 +417.2652209290633 +364.44312329429 +367.34122742724816 +367.9020163668194 +259.5187753107504 +359.6387804995161 +390.1366970239308 +381.59557830160554 +372.3630564363575 +389.5016463842632 +438.5212944479415 +404.86764021191044 +401.74226776748725 +367.90037513457503 +399.868157726906 +360.3834223928209 +390.31418305541575 +359.5945900566215 +419.63914866076703 +434.71820144321606 +342.9503936155089 +389.9619640271784 +377.9843584055145 +453.95431972998057 +318.72288747175986 +435.7208665754796 +381.850640263461 +331.6379434212657 +344.30903425660705 +319.59782096921805 +421.11995486516645 +327.91747816564487 +334.29660624084994 +416.96074940577614 +343.1299391287457 +368.5884633413173 +307.88623932898935 +357.6691712135963 +374.41675152093063 +390.3820813627952 +340.42442283459286 +449.3655812032352 +280.7203034466081 +432.9910882803637 +398.1944230838914 +373.7319348371288 +366.7451558769078 +398.12952276074503 +413.05195963270046 +386.70687705703614 +349.63595739839684 +441.6992092661407 +410.62451820009454 +352.73860530586916 +425.6704170323477 +385.6156069137199 +451.706927121833 +378.00215748096645 +426.4246931354036 +420.8411010359715 +405.5864724045981 +379.13689839566194 +277.78873758828917 +407.70749683603924 +392.0459940249719 +354.87599688174816 +372.95036204174704 +393.40227305640394 +376.38434403243224 +366.1730523175392 +385.52300929639875 +356.360456857372 +349.04194144732344 +353.5899177653226 +335.2583630417545 +409.2515473073075 +345.68540797091407 +410.71947848594124 +357.7785305770003 +291.6167573864572 +368.9659181683161 +344.28703045003095 +434.5450574416387 +486.35135443894274 +440.828534854595 +392.9979874352648 +383.82768909631557 +444.0001014570636 +347.64842197388367 +334.5921494607277 +397.57551299272603 +378.79047521144275 +359.71216334621704 +331.61944514558235 +355.9669303077394 +390.01760215321576 +456.7589173912027 +441.98298326253706 +374.75672872139086 +384.0157210155918 +401.89200215000915 +383.84603066079103 +388.16976700553084 +400.7944494402521 +331.019956302642 +419.88659636386814 +366.298530699302 +367.1010646775931 +390.6772903360202 +332.3679952893478 +344.2642956774381 +335.2632549727022 +367.15255736863907 +374.15549523092704 +422.0165378042172 +354.1441657767319 +431.3330526414346 +303.3455313756372 +410.8801971240926 +365.7037834292586 +339.46560225111654 +360.50270362281015 +414.51621303929414 +368.42788341376206 +412.2655139658422 +360.1140393560589 +388.11721333725336 +379.21415102092794 +297.12790761234174 +371.9769606098304 +375.063080426219 +388.8942086829626 +364.3705614166644 +419.33563999372996 +367.9251312699772 +425.27720355217764 +392.217887513465 +447.01652643443316 +394.8036033835142 +369.76900945966395 +371.7794113083027 +292.61463929734964 +420.7286688622623 +385.3946123448664 +382.88381537371765 +381.88440764626773 +389.9143873515628 +384.92455566510847 +400.8924677123709 +386.70261373568565 +412.2581220675855 +369.12134956796837 +415.8037071449816 +340.88282923608796 +374.59411295994624 +331.3182440863761 +434.7631997959187 +377.109736212753 +388.38460607108505 +364.86259296083836 +391.25204033826367 +376.73142829794034 +419.1304849043239 +405.178418302454 +392.6634566551837 +371.21605110488196 +406.8532862781002 +358.7529185130294 +368.25052409246547 +356.49554580102335 +413.608468309169 +389.65550537753944 +317.17553335881263 +352.2555719498324 +377.75012773980166 +363.3357726045107 +286.4430148619493 +404.2407533790842 +409.31274762236404 +382.0395355061931 +371.9299430120375 +401.55243966952463 +449.2066922743214 +373.75904622903994 +387.80593370025406 +415.0186701142282 +390.53667908705796 +367.7234827703234 +381.8162940374541 +359.52180405373235 +347.8212793774863 +391.49716596245383 +317.8790907971262 +401.75714297887197 +340.2126879921762 +346.76565856328375 +387.14588374044956 +349.5018761360482 +400.4609122233469 +314.18492761179584 +383.398896877666 +458.11733355408415 +434.4825384935359 +354.644197357476 +394.75040839932535 +474.84740314870714 +456.4996831699149 +355.8461892634356 +421.7427364996627 +359.215212340748 +415.99528589067154 +337.2405512257295 +411.1975260254868 +360.7388377649733 +359.77650565040034 +351.04734477315685 +398.9829017610137 +405.44764745163354 +376.89467443374804 +434.6419328513903 +430.1931374332547 +445.1915644169841 +391.88290530627836 +318.73291063590517 +352.410212734382 +368.31185535314836 +424.5199104054175 +368.5705414381619 +316.92820636569604 +438.3601826199578 +389.65564514699514 +344.7708971285041 +358.9216915425391 +396.75882947476936 +425.45110781488495 +413.18865945462346 +409.30486123671494 +460.23796903113106 +350.32997486545594 +384.08214644938937 +352.3144410091956 +500.2767257806899 +398.7047841921331 +357.09244220292396 +406.3938319586409 +452.3404858284475 +423.5589961037318 +380.053830849777 +376.67171956298375 +440.2071322081371 +374.98959204651993 +356.1901527170072 +374.91105502466525 +305.41827781351236 +403.77420787746973 +340.0529660937793 +395.62437198147006 +476.5321125176156 +411.47108802779144 +334.3032399956958 +362.6265110900033 +344.1779456841939 +345.5759134264457 +325.03014898708585 +298.3530147744124 +417.4581624269458 +426.09204218391034 +360.62901920949406 +279.5201056016159 +353.2836712405393 +377.4536209577675 +414.435687479275 +425.0095637511264 +381.48223656757506 +393.6215307427037 +407.8816855790023 +434.68114065437226 +348.0847737435461 +336.99509241374614 +466.6295327054041 +321.94799777615015 +441.1268985232608 +318.21441960432657 +318.14660247617644 +368.5898440941216 +421.4910554762307 +440.5017930450878 +313.7448267735528 +391.94107869494184 +386.42085510189474 +327.5669610775972 +409.8849810684995 +328.53303343692147 +399.0425275519751 +318.39819667312844 +397.3048459123286 +351.2372208727507 +350.61888609525374 +395.73733993809265 +351.504612900676 +371.9279445911842 +413.0893726688087 +378.8041412052643 +356.0888498626806 +291.4001080240899 +344.401445514654 +342.4288096552943 +394.32607221445755 +387.8373331202377 +390.2792869283687 +383.4419818712296 +344.6969403799473 +359.46096516272274 +427.52520359273217 +394.5921276087249 +402.0273981629191 +429.29039793204515 +380.4897484870393 +370.33693193577085 +368.3850264279469 +387.3042799467368 +427.3525932563491 +348.372447519527 +393.2862644082146 +404.82570866930917 +448.7933597575075 +357.56800424624055 +413.61692365532946 +396.96279370017703 +409.9731706536701 +394.542289915097 +406.9245171693186 +314.10059933431415 +378.09021400279164 +349.60021312488027 +327.0816642328759 +369.3261425274211 +396.933507057874 +311.6480682255596 +364.48652735752 +419.29470448497676 +373.36064257249274 +432.3509304083142 +372.4645449440519 +335.6687085158836 +381.32290644719774 +319.86331799156915 +402.6767317585508 +317.8853906582724 +419.896428580348 +374.97629559466833 +360.8377066542338 +358.8289185074921 +340.06051117371214 +387.93792442097185 +364.94634592465155 +327.1992689353037 +458.711201617779 +411.3938237550708 +335.6387936169365 +410.72935764519286 +444.0621813314218 +362.16316193230386 +362.378308773023 +357.1650076100813 +348.6282210349748 +324.96435569241726 +299.0776241046002 +352.8091101724152 +377.1434319460661 +346.38435231128483 +391.7557083955268 +369.5185627134703 +409.10604553921024 +314.53578918213816 +328.5559835109486 +420.44768390182185 +323.28651338040055 +398.8692864882758 +347.09828939644626 +331.1605033141271 +419.3951750757265 +387.0438901567677 +387.1680400227954 +473.0070357842107 +425.9269222197187 +399.12958803995224 +398.3724812524663 +333.87748035069 +376.61425596314683 +356.6004103057968 +397.15643722191635 +410.97904589502235 +378.1997929030679 +361.8895928709358 +363.6320916154579 +358.90982913942065 +325.2326103378921 +434.66355299786966 +384.1191941789658 +401.9730638458948 +329.4675507239138 +361.70212038243534 +458.0443371911052 +404.0225181981203 +345.30709617361657 +283.34482404711827 +355.4873484807602 +374.5610218354148 +403.9661484001598 +406.7652279915091 +367.2184851384657 +299.0900526446047 +424.2354866222337 +407.85020427388304 +357.54243561263905 +386.50266505850254 +403.099143289778 +401.20893258440293 +310.1407485319204 +342.3390413105906 +409.89513588417753 +374.14096485479024 +332.7835503522784 +368.84047190529185 +352.9529749437061 +376.6349224301586 +389.21189900840375 +412.16435264573715 +317.2993976857252 +338.2004620815506 +418.1931238736342 +366.7623468140464 +424.50557697715 +394.60898782874244 +369.87690759694067 +444.62631026684863 +415.47029699121794 +342.08728899061805 +389.45860868642455 +357.23070313672156 +290.7019737112462 +426.96089006279703 +284.0057027409679 +477.00358101005685 +432.0221446469947 +370.30766682361127 +341.51943145789454 +378.75473129087936 +402.4051258227189 +343.6670632641189 +365.6093493965896 +472.9814798569234 +380.12186716184624 +417.8057288264853 +387.0183652893594 +401.0528496331973 +342.56649033407905 +437.348004693834 +443.22471240123485 +369.09981413024997 +370.5970058326521 +470.6284808364373 +360.1456177233001 +300.30806685975426 +332.8224299088115 +416.7865560744219 +371.18020059246095 +393.36330808520347 +343.8533706542025 +416.29700614399206 +381.3641066708291 +421.52421648548994 +317.8588796397048 +403.1365012651916 +430.18165692546705 +373.5185404089028 +420.8182522595045 +437.5354867120701 +380.93001980166383 +329.426419679104 +362.3960693765793 +356.9011962920741 +377.96164939850314 +394.6073035362112 +344.12355454170904 +391.45830970083 +368.2353026340201 +386.2871285574828 +385.78325225784886 +357.8169922369791 +411.77526801175947 +337.2841928264435 +438.3925508963954 +397.09336413733536 +393.9163634678486 +410.16383454474123 +421.4166935374338 +340.4219574566946 +413.1181005862423 +349.4383777428964 +469.26975266295284 +366.78454156828786 +458.4702669595393 +341.9862529688886 +394.7598855449154 +384.186044568381 +433.70878749337305 +336.41653757632105 +352.9196603998176 +519.7293631901017 +352.5906681608932 +344.04430878988734 +366.94938446424044 +374.77454226792275 +440.36410848381814 +351.972427974846 +385.6036407423692 +433.85253967260246 +381.17155942163834 +329.65190698886903 +432.113537988097 +338.33427439358303 +381.24820708516955 +349.7036933473177 +350.94246791502246 +393.7230330155718 +422.28294438688954 +378.55153650338417 +349.4923665187665 +366.60526818194586 +454.4650683808038 +377.28285021331084 +349.762488286515 +307.98759406743204 +381.53380973194396 +325.38358146832456 +318.6580937404711 +333.6851896984545 +457.5892376078677 +322.4717460452083 +376.6635518736575 +302.6598319559551 +376.38935702631755 +344.7497937054668 +357.7405895229484 +364.5249152502861 +388.30883408437063 +346.8599380024639 +433.1651894909404 +288.6742457444044 +373.32536349125536 +409.8956624903084 +379.79326881866047 +380.7538044015939 +371.7139254358459 +383.6525459679786 +352.53297443558887 +359.23154842530687 +412.1442332561402 +406.3920834286326 +317.82171084719073 +390.9225197284425 +386.4658301596881 +435.5421713264314 +338.1016440175467 +399.311464102976 +366.47746595650636 +315.8532800719084 +377.6955488262299 +434.6746678461724 +419.71809087286186 +384.8218057027815 +420.11789081215284 +372.76153103649204 +483.13401792814005 +336.5745540049965 +379.72331102952927 +465.212430312902 +370.04289759069843 +326.7887395725726 +422.5024074919348 +364.12507472138043 +402.48512477660717 +347.6592890490604 +442.43849403621863 +381.532214736565 +348.34527753738945 +440.73296360680956 +468.2832707865252 +433.06967577452184 +314.48896500268285 +371.54440414561395 +322.6970780555782 +352.03751959861097 +289.91184321328444 +392.57885201536925 +369.3061431419022 +308.9392539369785 +374.4969085978394 +410.4437348800877 +335.4534836725137 +383.34295168237 +351.79024307779775 +428.33659775447074 +373.54793964326734 +396.2181352180732 +399.05845597562165 +373.4574615097371 +420.7760044708622 +383.9380949658711 +417.91632034940864 +429.9063996890829 +322.74171533718703 +432.19702306045355 +366.11686358455535 +447.678791881291 +322.5065585223539 +395.29765770231023 +397.7740576221955 +390.94147790210747 +328.525609066973 +382.7036147793958 +393.0871847017381 +315.56626914198233 +352.695087238765 +356.05351960323344 +409.1514624943735 +346.9368242623386 +410.1938055632425 +450.09916083825976 +371.85964709376856 +389.58640032326895 +360.08820671348565 +437.61130493564985 +470.60506486422474 +373.35457530748613 +449.5595127347619 +374.84559950618114 +390.94596887825315 +314.5111216379819 +372.6756956489709 +408.3482300217573 +380.42777979292987 +376.1511810500611 +425.4571479024974 +379.70299822159467 +385.30323100417195 +371.94888742052876 +429.86124674289147 +412.9611737240052 +368.8068382917369 +394.8024227551578 +331.205578610621 +323.4268662676417 +424.12657621526296 +394.67743815488103 +405.52867208743623 +309.888261010493 +375.4857743199829 +367.9959767363331 +352.2698259636365 +358.14954789111624 +361.39357648546314 +394.96104061603637 +442.7595801241164 +377.06172540473733 +358.07129782018944 +453.44543714257156 +350.6661451130156 +356.2082888627373 +316.2414982058517 +348.63935811932726 +429.2740212578717 +401.7262309872173 +351.6453201529007 +363.8424104097532 +390.85146107837147 +377.7083822035214 +338.9051256751015 +373.8652568972069 +358.4708161028501 +459.5168009943588 +357.4144886763995 +407.3558838283962 +322.0956366756968 +349.22064869677945 +302.6066532076121 +349.3974545875042 +388.83236458132245 +303.19890262806547 +410.111837130661 +463.4396887759371 +344.16412862641533 +339.9338207507608 +400.3059357803318 +389.2659100203236 +403.1786445796954 +437.4766151820347 +358.028025055539 +354.8463121082685 +368.54650956266624 +436.7060569962552 +380.54151048135463 +413.96275423117476 +403.691528244249 +343.3668967106564 +428.82676888248125 +362.73476959246744 +350.80459205313423 +334.54054347171393 +361.4941526092109 +361.84764544544186 +311.46988652337495 +366.7094680758986 +367.7086943854187 +365.2330804922449 +318.2494103228234 +409.94179099906404 +437.2558715628857 +423.53527482702646 +337.26672587992533 +401.129258700385 +415.66969047306327 +459.37230831937694 +339.6617404458673 +443.57734967897966 +408.89724338469 +406.85707770106126 +424.03976597108397 +419.4475056776 +328.3571988733229 +382.85164475105574 +319.0480681693924 +374.6989382869177 +384.75051586838356 +407.33218337592797 +412.4605724768434 +440.90659609557537 +362.03369941514876 +361.2552093127611 +374.5290283952447 +354.49698553126603 +440.43180737265607 +376.8383265188841 +348.03806497977763 +430.0901898171521 +397.5997785232208 +446.88576681437524 +435.2160320079868 +430.9678325831496 +382.1331288044091 +367.58741402866985 +364.8780745457706 +344.1941945893195 +389.5574334565387 +288.4029624077707 +340.08048373479005 +380.9159182636296 +337.55718339756453 +408.77231419806105 +329.29456308059116 +369.3715164222975 +401.86819439977694 +373.7726578680731 +439.6889411867537 +397.3151239086632 +422.679720576366 +398.4189140068552 +460.158239027559 +387.1389312688905 +331.6838986300144 +401.5957509060707 +368.5528005999832 +308.58964358562673 +299.3176495554718 +358.31595225189653 +403.2451751935378 +423.3773889910242 +410.02524536449476 +382.9242334531224 +430.88526236541185 +348.2925385686973 +386.76583788422374 +366.66655038213804 +356.52861539541135 +415.0089589606859 +333.8357235199083 +360.3172140252234 +362.52806009729704 +333.20625695235645 +334.7465978857992 +346.5113949815007 +346.4149851169814 diff --git a/data/surface_code_rotated_memory_x_13_0.01_1000_shots_no_buckets_weights_pymatchingv2.2.2_correlated.txt b/data/surface_code_rotated_memory_x_13_0.01_1000_shots_no_buckets_weights_pymatchingv2.2.2_correlated.txt deleted file mode 100644 index bdf3ee7b6..000000000 --- a/data/surface_code_rotated_memory_x_13_0.01_1000_shots_no_buckets_weights_pymatchingv2.2.2_correlated.txt +++ /dev/null @@ -1,1000 +0,0 @@ -311.72786034888975 -352.5969147261106 -420.70768120786505 -361.12397567659474 -426.6261559816895 -345.7056455998233 -420.89880711463684 -312.34992795912143 -388.08705560652476 -452.8687660162192 -386.6793170616448 -407.697448965172 -400.2944517430124 -348.18263001015947 -401.8524865718622 -377.6384251202965 -404.88536587310284 -437.5242197409508 -370.36705507708876 -368.1422977087399 -395.656501308611 -385.7620362427501 -402.08603568500223 -445.80969201096974 -456.69736800546025 -309.0187707568354 -378.06143561305464 -366.78893548231156 -352.84159068796106 -382.4017071079416 -294.4461680085421 -414.77696001787217 -312.7775201369901 -210.64203304459792 -422.0268560372133 -465.1141999159275 -360.5491173177278 -337.5702610184502 -357.73504568749416 -432.71034968123655 -367.65886551562005 -395.1964028496149 -437.55829595778204 -401.99697077596795 -336.03849543524603 -331.12388618741903 -360.30824548515255 -375.43101151780917 -407.5453692088299 -393.8619070290272 -341.07106092685893 -334.2511169302867 -377.5285260914943 -407.73079845142445 -439.035004375868 -444.04309185917737 -318.1558904388669 -368.3285638033024 -359.9642435596853 -335.03954548805865 -400.0687261898571 -423.20776710913856 -411.27107687789714 -370.9067310638871 -310.48168717681796 -378.4028683923914 -388.50547382557716 -400.9882419082295 -388.03339966549476 -351.9273120887375 -373.34006999102445 -374.5934165833402 -422.163542799869 -366.190601149193 -359.4290225478092 -416.69458106649415 -372.9476601852243 -390.848768045678 -313.68522251273475 -407.30576024269993 -384.7422084096017 -424.7400070614044 -421.2880466950565 -343.6003748802091 -420.01692114561956 -368.72781666517864 -342.06765738230314 -361.387692050199 -403.2637617075139 -387.1780776580207 -384.0135994140819 -388.7640624955156 -391.5119864660971 -372.1274333703857 -351.46316455096564 -412.1253520262665 -405.2170257320924 -439.8192744393813 -335.04320384767436 -303.2273107699263 -408.29202328816166 -437.9997584893581 -397.88105925841836 -349.98135701842057 -406.3149020999071 -347.6408970122815 -334.2311408396771 -473.11955972574435 -382.83845594992124 -364.35531666330974 -376.02300822379226 -370.1735541484304 -344.34866030909643 -311.9476887604668 -370.5712028381452 -368.93383260736834 -417.3252226151517 -358.0016026282173 -314.65009765490356 -365.93929213840306 -316.36379012638815 -407.18479083769455 -338.81648148624686 -407.32459947114626 -365.64815800953534 -367.8584499451308 -366.29605508576174 -459.02974538398723 -413.2813979002598 -369.5545424067518 -391.79403593330073 -298.76599822054027 -337.86580353242164 -374.1947990371715 -386.60420968575113 -399.7963875232426 -435.03863739137313 -392.31432031994035 -386.3067344002162 -375.1500833828293 -398.70918375340756 -409.4589270605493 -371.2163595859533 -406.3707332913289 -369.1532237099667 -349.0816553851524 -388.47814889699765 -371.3542763904093 -395.2963503637655 -389.39526912219964 -358.10943123371936 -354.62629698446403 -268.2252723589884 -351.78341484575486 -279.97202507678423 -328.9975621641179 -333.37192434691605 -460.030894582382 -442.4236661205588 -351.6959205783308 -359.8820933562208 -423.61814681972527 -412.8969443648366 -332.71450282937474 -384.2520891657073 -415.37846810590287 -420.55781587971677 -293.93473639333325 -498.7180341059892 -374.52903510135496 -287.8005747604383 -389.8305069716549 -361.92425287231157 -356.1453135461846 -365.6968891949727 -372.026272756187 -375.91983965900465 -408.1481835765459 -324.1666638786768 -351.3268893317071 -364.7641931463419 -337.8608290104319 -380.79948889526065 -445.6976530270928 -416.2843485373796 -341.89365746928655 -389.78894461807033 -291.0863859511484 -463.75895927272404 -374.24148768260926 -348.9834419299301 -358.136045667566 -406.733110664776 -311.71767870877073 -313.1660926359169 -365.7744870084398 -370.52511774262956 -399.91157979074774 -311.0721248886455 -370.2090901795762 -435.59812746327566 -305.77605691304984 -376.35878422266006 -389.7148505707301 -368.60005255868157 -415.17731656431357 -409.7362483670764 -364.44312329429 -367.46067913361895 -370.0953640795427 -259.5187753107504 -359.6387804995161 -390.5663666841631 -378.6349068659602 -374.24835120996926 -383.62713828102306 -434.6124432610141 -404.86764021191044 -403.2099028184107 -367.90037513457503 -398.03018797329906 -360.3834223928209 -390.31418305541575 -362.99593340874026 -421.10678371169047 -434.71820144321606 -344.07498995016834 -389.8632931446467 -378.4140280657468 -450.6504083947639 -318.72288747175986 -436.7241165511472 -381.850640263461 -334.53046630573346 -346.47421207085983 -317.30980627473303 -422.57557997854593 -325.5308225896477 -334.29660624084994 -416.96074940577614 -343.1299391287457 -370.49019232046936 -307.88623932898935 -357.6691712135963 -374.41675152093063 -390.5781553200689 -337.7081220563053 -452.03735199767783 -276.5160237495835 -432.9910882803637 -398.1944230838914 -373.7319348371288 -366.7451558769078 -398.12952276074503 -416.96412328513617 -385.2348177381163 -347.2493018223997 -439.4111945716557 -409.92613505526543 -352.7822702014924 -424.2173716536938 -385.48162059577425 -453.60865610098506 -381.0010442152774 -424.6147859825032 -420.8411010359715 -399.3920126049512 -381.69553887502343 -277.78873758828917 -407.70749683603924 -390.63993765490414 -356.01221525841675 -374.4179970926705 -391.445287140639 -376.43336005107847 -366.1730523175392 -385.52300929639875 -355.9307871971398 -349.04194144732344 -353.8966640717957 -330.58369277127224 -412.4957619079754 -345.68540797091407 -410.71947848594124 -357.7785305770003 -291.6167573864572 -368.9659181683161 -342.5317805663062 -433.0729981227189 -486.55983999446875 -443.6778950958016 -392.9979874352648 -383.42223590608734 -450.0610983683172 -347.64842197388367 -327.96225804033475 -395.75969281535464 -375.7408443997613 -359.71216334621704 -328.82953951304927 -355.9669303077394 -395.741520315448 -456.7589173912027 -441.3978606725091 -369.99586305115326 -385.85369076919875 -397.99970093726205 -389.7611417908975 -387.2511820246699 -402.0667347938084 -321.3001511722272 -419.88659636386814 -361.79978287775793 -367.1010646775931 -388.06649749613644 -333.2291427889064 -347.3031176512161 -335.2632549727022 -367.15255736863907 -375.6231302818505 -422.02659661663273 -353.6592391798868 -432.60493068703175 -302.21156201657317 -409.8168095753658 -361.7665283359084 -339.89527191134874 -360.50805474583314 -408.3358106585352 -368.42788341376206 -409.97965863885634 -361.01225823305646 -388.11721333725336 -379.64824494915655 -297.12790761234174 -372.5796263842615 -377.43772606467223 -388.8942086829626 -364.3705614166644 -422.6292348607164 -368.28482443456016 -425.8575231554569 -387.3378821474596 -450.32929301175295 -400.50422910714366 -369.4201890175085 -371.7794113083027 -292.61463929734964 -420.7286688622623 -388.2456529961194 -378.07304388989013 -380.8811576706001 -391.7523571051698 -384.92455566510847 -400.8924677123709 -389.2212512085713 -413.4121674030065 -370.1528163848782 -414.09240063693187 -338.59481454160294 -374.0024667364618 -334.13722882474775 -438.6300050834175 -377.109736212753 -383.2575606628909 -364.7280863899189 -394.29883940665565 -376.3022503014751 -420.60254422324374 -401.7658072733096 -392.6634566551837 -371.21605110488196 -407.5463182999063 -357.2869769314196 -368.25052409246547 -356.49554580102335 -409.28298872871846 -390.2581711519705 -315.3650643044643 -352.2555719498324 -376.6482368826219 -360.9491170285135 -289.71446015270016 -407.2686345104727 -410.30523146746174 -381.7220940127374 -369.6419283175524 -400.0759476117323 -449.2066922743214 -375.97827211529557 -390.297274833767 -415.0186701142282 -390.53667908705796 -369.1791078837029 -381.8162940374541 -360.107946678424 -346.34478731969403 -391.49716596245383 -317.8790907971262 -404.14379855486914 -337.8897916417241 -346.76565856328375 -387.14588374044956 -355.1472449230648 -400.801969813463 -313.49180911646283 -383.398896877666 -453.5703031505829 -439.1726003458918 -354.56800041514396 -394.75040839932535 -475.90745211339095 -459.3024437098828 -355.8461892634356 -422.84462735684247 -359.215212340748 -416.38001931795924 -338.2271163991055 -408.8968646659377 -361.21933162294596 -357.960685473029 -356.8222314909764 -403.8802226566269 -408.7355269479247 -377.3243440939803 -436.82542364091177 -430.1931374332547 -444.6104333743651 -393.33853041965784 -327.0721387327015 -352.8171843291512 -368.4948527483959 -422.9249277327386 -367.5672914624943 -315.4507959237532 -438.3601826199578 -389.65564514699514 -344.7708971285041 -358.9216915425391 -392.96417663921807 -423.6381691472003 -415.1456453703884 -408.2784141198007 -459.5475100379403 -354.9378046292117 -381.75240845467385 -352.3144410091956 -500.2767257806899 -398.7047841921331 -354.8044275084389 -404.6335496686064 -449.84205210096667 -421.0885349738989 -385.5604170382095 -382.6383495026708 -440.2071322081371 -376.187644995093 -359.4940640522239 -374.91105502466525 -305.41827781351236 -407.53871462974706 -340.0529660937793 -395.62437198147006 -472.80853633274705 -414.7589675240826 -334.3032399956958 -362.6265110900033 -343.08002307951386 -345.5759134264457 -326.9871349028508 -300.1126208061715 -417.4581624269458 -426.09646645190674 -360.1561025501929 -279.5201056016159 -353.7133409007715 -377.4536209577675 -417.0662248724883 -428.66956459905185 -384.1565069763736 -390.317619407487 -409.0357309144233 -437.1520256809633 -346.367898340367 -336.99509241374614 -468.5312616845561 -321.94799777615015 -442.6441605547692 -318.21441960432657 -319.17304959309064 -369.80158739028496 -421.4910554762307 -440.5017930450878 -315.21246182447624 -392.91532968514065 -385.8635872231558 -327.5669610775972 -412.6044873674846 -328.53303343692147 -398.2746698109056 -321.45806206790456 -394.9894296984259 -352.3912662081717 -349.525633413977 -395.73733993809265 -351.504612900676 -370.8007321676226 -413.28149143285003 -378.8041412052643 -349.95855447881894 -291.4001080240899 -344.401445514654 -344.15417711176366 -401.52643443285086 -385.5696937063985 -386.17809426394916 -379.2522381975925 -344.6969403799473 -359.46096516272274 -427.0402769958871 -393.3073628899075 -399.1267771208997 -427.00238323756014 -380.4897484870393 -374.34007950363065 -368.3850264279469 -384.2295061629779 -427.3525932563491 -351.78505854867143 -397.61746041822 -402.3931532982111 -448.7933597575075 -354.70632276279326 -411.0061308154457 -395.00580778441207 -411.8116963085211 -387.1185916365149 -406.9245171693186 -313.6362142590583 -378.09021400279164 -347.1614030706419 -325.78788932551345 -369.3261425274211 -398.83523603702605 -312.52778282666986 -364.820091045913 -419.29470448497676 -373.36064257249274 -432.3509304083142 -373.6185902794729 -336.6719584915512 -381.7570003754264 -317.72900169666764 -401.6734817828832 -315.49873508227523 -422.3149145321504 -372.68828090018326 -359.176576674856 -358.48361489073085 -340.06051117371214 -389.1170082543317 -363.49538579333097 -325.95755109110735 -458.711201617779 -412.86588307399063 -341.3688683413276 -418.2797947013107 -441.32816971597504 -361.8663533753087 -362.378308773023 -355.2632786309292 -349.7983282103409 -324.96435569241726 -299.0776241046002 -347.61506895809947 -377.1434319460661 -346.38435231128483 -391.7557083955268 -372.3669971585099 -412.8235946957336 -313.50345374747496 -327.07949145315627 -419.0580617372944 -323.28651338040055 -403.4469405206912 -350.5449911135019 -331.1605033141271 -416.09126374050976 -381.34326443313824 -390.13521179698796 -473.0070357842107 -425.9269222197187 -396.1940994600926 -398.5001130015243 -333.4478106904578 -377.4890006306586 -362.27052111008874 -395.1046057300852 -411.65611102128634 -378.1997929030679 -361.8895928709358 -362.02457910521446 -358.92578015207005 -325.2326103378921 -435.57371651607457 -384.1191941789658 -407.13527468440526 -330.9198760780992 -361.1787914217441 -458.0563471286491 -402.9845528074291 -345.30709617361657 -283.34482404711827 -355.4873484807602 -376.02865688633824 -407.14271211362103 -404.09095758271064 -366.01355595621845 -300.83488158596066 -424.2354866222337 -404.87435408712605 -359.83045030712407 -384.6868448811312 -403.28223245284994 -399.6071446216372 -315.6749614238935 -344.6270560050756 -411.3304792495015 -374.14096485479024 -331.6402789123971 -368.84047190529185 -353.007002544425 -376.6349224301586 -391.07024404265655 -415.5616328009533 -316.4400583652607 -338.2004620815506 -418.1931238736342 -366.7623468140464 -422.0178147887892 -392.592318237696 -372.2083062363249 -446.5650305030698 -415.47029699121794 -347.29292930498684 -384.7467590348332 -361.4204468103586 -288.315318135249 -433.5022590631793 -287.37506677104335 -477.6548198469047 -438.1028151679905 -367.9210112476141 -341.51943145789454 -382.17935225756776 -403.35784243405885 -344.6747375077829 -363.3213347021046 -470.94418191780767 -380.55153682207845 -415.51771413200026 -390.32227662457615 -401.0528496331973 -342.5951547199419 -438.81563974475745 -446.33482526827027 -363.3991884066205 -370.1468800654979 -470.6284808364373 -359.5720374078648 -302.03343431622363 -332.8224299088115 -416.7865560744219 -371.18020059246095 -395.17912826257486 -340.0805645610662 -423.0857924935027 -380.53020186176116 -420.3263294249071 -317.8588796397048 -403.1365012651916 -430.18165692546705 -373.2117941024297 -421.7261353472726 -434.24760721577894 -379.33503712898494 -329.426419679104 -362.3960693765793 -355.0391911334398 -376.1458292211318 -394.2848568138399 -342.8460832472137 -390.97338310398493 -368.2353026340201 -382.47839571404063 -388.67577514231664 -357.7372403503104 -416.0239746303032 -334.99617813195846 -434.13390511656104 -397.09336413733536 -393.9163634678486 -408.84216539533475 -418.48547110255004 -340.90153293051674 -412.0801351955511 -349.4383777428964 -469.23503724792926 -370.0884529035046 -456.50957115299576 -344.86809513745385 -396.91314448354234 -386.2294260083492 -435.451825197387 -336.41653757632105 -354.37528551319707 -515.3459262283283 -353.8381013757848 -344.5152206751782 -368.55347474053946 -378.6168229572994 -439.0700596847951 -351.972427974846 -383.7878205649978 -431.6820972088535 -381.17155942163834 -329.65190698886903 -439.70883574518086 -342.9730994459418 -380.81853742493735 -349.7036933473177 -349.894820312949 -395.6247619947238 -423.7594364446818 -378.55153650338417 -349.97729311561164 -366.60526818194586 -454.70895019802 -378.43689554873185 -350.0843480477632 -309.0117413414851 -379.38413538572 -328.6768120876387 -318.6580937404711 -333.74598235259873 -457.093388522198 -322.4717460452083 -372.8212711842808 -299.3559206207384 -376.6411432297945 -344.3144940892066 -357.95551400317 -364.95458491051835 -385.70397050480375 -343.42646002890666 -426.5840793753351 -288.6742457444044 -368.86453378180704 -409.8956624903084 -382.7203857022611 -383.47111956729447 -369.8555804015931 -389.1352880520023 -352.53297443558887 -357.39357867169986 -412.1442332561402 -406.3920834286326 -318.97307691509195 -384.4854780381077 -389.9867423986304 -432.2979567257634 -333.916324611906 -399.4254175048515 -366.47746595650636 -320.7215162144323 -378.5649423707187 -436.9626825406574 -419.5441675506833 -384.8218057027815 -414.69126334094716 -369.33272475110397 -483.13401792814005 -337.7285993404175 -379.72331102952927 -466.36647564832293 -370.04289759069843 -326.7887395725726 -420.3338445038205 -365.58069983475997 -401.48413758371777 -347.6592890490604 -442.86816369645084 -379.5752288208 -344.01679820794 -443.77402118597155 -468.2832707865252 -433.1612166500495 -314.48896500268285 -369.25638945112894 -326.8375932327602 -352.03751959861097 -289.91184321328444 -388.9046868037451 -373.55649487517513 -310.74018266711926 -375.20605893209796 -409.954536491016 -343.4853961493723 -383.34295168237 -348.0921956428224 -427.27147261728396 -373.54793964326734 -396.70306181491827 -399.05845597562165 -373.4574615097371 -425.6141188838809 -382.46160290807876 -420.22671721626887 -429.7995081742494 -322.74171533718703 -432.4270334651028 -364.6934525070777 -447.1560548230672 -322.5065585223539 -395.29765770231023 -397.7883324602367 -390.94147790210747 -328.525609066973 -381.6965832634559 -397.8426992489527 -315.12689785794345 -345.7324022737978 -356.05351960323344 -405.84755115915675 -346.9368242623386 -413.1767469321547 -452.0008898174118 -369.6236725206975 -391.3605392018372 -360.52230064171425 -437.61130493564985 -473.78162857768604 -373.35457530748613 -452.86342406997863 -374.57633400282504 -400.1576163870718 -319.3957919860461 -369.3717843137542 -412.9357533307355 -378.78378110160475 -378.05291002921314 -421.45601746200896 -379.70299822159467 -387.591245698657 -371.94888742052876 -433.2811639026721 -411.8194877497673 -372.3957060164722 -394.8024227551578 -328.8189230346238 -323.89906078475536 -423.98886871203723 -393.58159973867475 -414.3033042746313 -310.9350834080531 -375.4857743199829 -371.0332866587272 -348.9819464673453 -358.14954789111624 -364.48118117584136 -394.80606840845934 -442.6246623627529 -377.06172540473733 -358.07129782018944 -454.09282067193436 -350.6661451130156 -353.53401845393876 -323.7722973004976 -348.63935811932726 -432.7370767071447 -404.82534759821544 -355.40539416630554 -365.062563521118 -385.91334197278854 -377.7030310804984 -341.19314036958656 -373.8652568972069 -361.1200021297975 -461.90345657035596 -358.2089177910288 -408.6221573305937 -323.4557459549387 -347.50395612334285 -301.9576104453932 -349.3974545875042 -394.6673136931757 -300.8122470520683 -410.111837130661 -464.59373411135806 -346.049423400027 -339.9338207507608 -400.72019726989134 -389.2659100203236 -403.1786445796954 -437.4766151820347 -352.84275896295657 -351.6074486306235 -370.44823854181834 -433.45198264876 -380.14114405222443 -413.96275423117476 -401.5777252346831 -338.275023438889 -426.4872742032644 -366.1768296223735 -348.53051053802096 -330.31591814210975 -360.4909026335433 -363.3152804963653 -311.46988652337495 -366.7094680758986 -366.9235115850057 -365.2330804922449 -318.2494103228234 -411.779760752671 -438.73236362067803 -423.53527482702646 -337.26672587992533 -398.464379669556 -411.3442108926127 -459.0965625958044 -340.9465051646847 -450.30212267666224 -407.4198329427472 -399.68809478432087 -421.75175127659895 -417.6481991202324 -328.3571988733229 -380.79164133446034 -317.5939582839753 -380.92065842471385 -378.3090488511928 -409.00937272457867 -413.099364773075 -439.0048671164233 -362.0177484024993 -358.73787035459094 -374.5290283952447 -354.67433532282706 -440.43180737265607 -376.84920841809407 -348.03806497977763 -426.80627186725036 -404.2667974406068 -450.4472785506521 -431.6982451693723 -430.62479386688557 -382.7513859322085 -370.40373926489923 -365.3077442060028 -344.51905409956663 -392.86134479175547 -288.4029624077707 -340.08048373479005 -380.9159182636296 -337.55718339756453 -410.4976816545304 -331.02850729911177 -365.5292357329208 -401.05223902421176 -373.7726578680731 -441.8866041049436 -400.6083545279774 -422.679720576366 -403.00945577135036 -460.158239027559 -383.27578363510105 -331.6838986300144 -401.5957509060707 -367.69764942184383 -308.58964358562673 -302.26748356400674 -358.31595225189653 -400.7645147759274 -423.3773889910242 -405.82603654567544 -388.13558913818645 -432.40096152027974 -346.57584599526064 -386.76583788422374 -366.66655038213804 -360.1357145632329 -412.72094426620083 -333.8357235199083 -360.3172140252234 -367.1111810213755 -333.64035088058506 -332.4585831913142 -342.85441611862393 -345.65346288532834 diff --git a/src/pymatching/sparse_blossom/driver/implied_weights.h b/src/pymatching/sparse_blossom/driver/implied_weights.h index 9e1f04597..f652c6d82 100644 --- a/src/pymatching/sparse_blossom/driver/implied_weights.h +++ b/src/pymatching/sparse_blossom/driver/implied_weights.h @@ -23,6 +23,10 @@ struct ImpliedWeightUnconverted { size_t node1; size_t node2; double implied_weight; + bool operator==(const ImpliedWeightUnconverted& other) const { + return (this->node1 == other.node1) && (this->node2 == other.node2) && + (this->implied_weight == other.implied_weight); + } }; struct ImpliedWeight { diff --git a/src/pymatching/sparse_blossom/driver/mwpm_decoding.test.cc b/src/pymatching/sparse_blossom/driver/mwpm_decoding.test.cc index b5df18933..a40ca1fbf 100644 --- a/src/pymatching/sparse_blossom/driver/mwpm_decoding.test.cc +++ b/src/pymatching/sparse_blossom/driver/mwpm_decoding.test.cc @@ -86,6 +86,54 @@ DecodingTestCase load_surface_code_d13_p100_some_negative_weights_test_case() { "exact.txt"); } +std::vector get_syndrome_from_edges(const std::vector& edges) { + std::set syndrome; + for (size_t i = 0; i < edges.size() / 2; i++) { + int64_t u = edges[2 * i]; + int64_t v = edges[2 * i + 1]; + + auto u_it = syndrome.find(u); + if (u_it == syndrome.end()) { + syndrome.insert(u); + } else { + syndrome.erase(u_it); + } + + if (v != -1) { + auto v_it = syndrome.find(v); + if (v_it == syndrome.end()) { + syndrome.insert(v); + } else { + syndrome.erase(v_it); + } + } + } + std::vector sorted_syndrome; + for (auto& s : syndrome) + sorted_syndrome.push_back(s); + return sorted_syndrome; +} + +uint64_t get_observables_from_edges(const std::vector& edges, pm::Mwpm& mwpm) { + uint64_t obs_mask = 0; + for (size_t i = 0; i < edges.size() / 2; i++) { + int64_t u = edges[2 * i]; + int64_t v = edges[2 * i + 1]; + + auto& u_node = mwpm.search_flooder.graph.nodes[u]; + size_t idx = SIZE_MAX; + if (v == -1) { + idx = 0; + } else { + auto v_ptr = &mwpm.search_flooder.graph.nodes[v]; + idx = u_node.index_of_neighbor(v_ptr); + } + for (auto& obs : u_node.neighbor_observable_indices[idx]) + obs_mask ^= 1 << obs; + } + return obs_mask; +} + TEST(MwpmDecoding, CompareSolutionWeights) { DecodingTestCase test_case; for (int i : {0, 1}) { @@ -120,6 +168,220 @@ TEST(MwpmDecoding, CompareSolutionWeights) { } } +TEST(MwpmCorrelatedDecoding, NegativeEdgeWeightsThrowException) { + DecodingTestCase test_case; + test_case = load_surface_code_d13_p100_some_negative_weights_test_case(); + pm::weight_int num_distinct_weights = 10001; + EXPECT_THROW( + pm::detector_error_model_to_mwpm(test_case.detector_error_model, num_distinct_weights, true, true); + , std::invalid_argument); +} + +// For simplicity, we say two previous weights are equal if val and the value at ptr are equal +bool previous_weights_equal(const pm::PreviousWeight& prev1, const pm::PreviousWeight& prev2) { + return (*prev1.ptr == *prev2.ptr) && (prev1.val == prev2.val); +} + +bool graph_structure_equal(const pm::MatchingGraph& graph1, const pm::MatchingGraph& graph2) { + if ((graph1.negative_weight_detection_events_set != graph2.negative_weight_detection_events_set) || + (graph1.negative_weight_observables_set != graph2.negative_weight_observables_set) || + (graph1.negative_weight_sum != graph2.negative_weight_sum) || + (graph1.is_user_graph_boundary_node != graph2.is_user_graph_boundary_node) || + (graph1.num_nodes != graph2.num_nodes) || (graph1.num_observables != graph2.num_observables) || + (graph1.normalising_constant != graph2.normalising_constant) || + (graph1.previous_weights.size() != graph2.previous_weights.size()) || + (graph1.edges_to_implied_weights_unconverted != graph2.edges_to_implied_weights_unconverted) || + (graph1.loaded_from_dem_without_correlations != graph2.loaded_from_dem_without_correlations)) { + return false; + } + + for (size_t i = 0; i < graph1.previous_weights.size(); i++) { + if (!previous_weights_equal(graph1.previous_weights[i], graph2.previous_weights[i])) { + return false; + } + } + + if (graph1.nodes.size() != graph2.nodes.size()) { + return false; + } + for (size_t i = 0; i < graph1.nodes.size(); i++) { + if ((graph1.nodes[i].neighbors.size() != graph2.nodes[i].neighbors.size()) || + (graph1.nodes[i].neighbor_weights != graph2.nodes[i].neighbor_weights) || + (graph1.nodes[i].neighbor_implied_weights.size() != graph2.nodes[i].neighbor_implied_weights.size())) { + return false; + } + for (size_t j = 0; j < graph1.nodes[i].neighbors.size(); j++) { + if (j == 0 && graph1.nodes[i].neighbors[0] == nullptr && graph2.nodes[i].neighbors[0] == nullptr) { + continue; + } + auto node_i_j = graph1.nodes[i].neighbors[j] - graph1.nodes.data(); + auto graph2_node_i_j = graph2.nodes[i].neighbors[j] - graph2.nodes.data(); + if (node_i_j != graph2_node_i_j) { + return false; + } + } + for (size_t j = 0; j < graph1.nodes[i].neighbor_implied_weights.size(); j++) { + if (graph1.nodes[i].neighbor_implied_weights[j].size() != + graph2.nodes[i].neighbor_implied_weights[j].size()) { + return false; + } + for (size_t k = 0; k < graph1.nodes[i].neighbor_implied_weights[j].size(); k++) { + if (*graph1.nodes[i].neighbor_implied_weights[j][k].edge0_ptr != + *graph2.nodes[i].neighbor_implied_weights[j][k].edge0_ptr) { + return false; + } + if (graph1.nodes[i].neighbor_implied_weights[j][k].implied_weight != + graph2.nodes[i].neighbor_implied_weights[j][k].implied_weight) { + return false; + } + if ((graph1.nodes[i].neighbor_implied_weights[j][k].edge1_ptr == nullptr) && + (graph2.nodes[i].neighbor_implied_weights[j][k].edge1_ptr == nullptr)) { + continue; + } + if (*graph1.nodes[i].neighbor_implied_weights[j][k].edge1_ptr != + *graph2.nodes[i].neighbor_implied_weights[j][k].edge1_ptr) { + return false; + } + } + } + } + return true; +} + +bool graph_structure_equal(const pm::SearchGraph& graph1, const pm::SearchGraph& graph2) { + if ((graph1.num_nodes != graph2.num_nodes) || + (graph1.negative_weight_edges != graph2.negative_weight_edges) || + (graph1.edges_to_implied_weights_unconverted != graph2.edges_to_implied_weights_unconverted) || + (graph1.previous_weights.size() != graph2.previous_weights.size())) { + return false; + } + + for (size_t i = 0; i < graph1.previous_weights.size(); i++) { + if (!previous_weights_equal(graph1.previous_weights[i], graph2.previous_weights[i])) { + return false; + } + } + + if (graph1.nodes.size() != graph2.nodes.size()) { + return false; + } + for (size_t i = 0; i < graph1.nodes.size(); i++) { + if ((graph1.nodes[i].neighbors.size() != graph2.nodes[i].neighbors.size()) || + (graph1.nodes[i].neighbor_weights != graph2.nodes[i].neighbor_weights) || + (graph1.nodes[i].neighbor_implied_weights.size() != graph2.nodes[i].neighbor_implied_weights.size())) { + return false; + } + for (size_t j = 0; j < graph1.nodes[i].neighbors.size(); j++) { + if (j == 0 && graph1.nodes[i].neighbors[0] == nullptr && graph2.nodes[i].neighbors[0] == nullptr) { + continue; + } + auto node_i_j = graph1.nodes[i].neighbors[j] - graph1.nodes.data(); + auto graph2_node_i_j = graph2.nodes[i].neighbors[j] - graph2.nodes.data(); + if (node_i_j != graph2_node_i_j) { + return false; + } + } + for (size_t j = 0; j < graph1.nodes[i].neighbor_implied_weights.size(); j++) { + if (graph1.nodes[i].neighbor_implied_weights[j].size() != + graph2.nodes[i].neighbor_implied_weights[j].size()) { + return false; + } + for (size_t k = 0; k < graph1.nodes[i].neighbor_implied_weights[j].size(); k++) { + if (*graph1.nodes[i].neighbor_implied_weights[j][k].edge0_ptr != + *graph2.nodes[i].neighbor_implied_weights[j][k].edge0_ptr) { + std::cout << *graph1.nodes[i].neighbor_implied_weights[j][k].edge0_ptr << std::endl; + std::cout << *graph2.nodes[i].neighbor_implied_weights[j][k].edge0_ptr << std::endl; + std::cout << graph1.nodes[i].neighbor_implied_weights[j][k].implied_weight << std::endl; + return false; + } + if (graph1.nodes[i].neighbor_implied_weights[j][k].implied_weight != + graph2.nodes[i].neighbor_implied_weights[j][k].implied_weight) { + return false; + } + if ((graph1.nodes[i].neighbor_implied_weights[j][k].edge1_ptr == nullptr) && + (graph2.nodes[i].neighbor_implied_weights[j][k].edge1_ptr == nullptr)) { + continue; + } + if (*graph1.nodes[i].neighbor_implied_weights[j][k].edge1_ptr != + *graph2.nodes[i].neighbor_implied_weights[j][k].edge1_ptr) { + return false; + } + } + } + } + return true; +} + +TEST(MwpmCorrelatedDecoding, BetterLogicalErrorRateThanUncorrelated) { + DecodingTestCase test_case; + test_case = load_surface_code_d13_p100_test_case(); + pm::weight_int num_distinct_weights = 10001; + auto mwpm_correlated_untouched = + pm::detector_error_model_to_mwpm(test_case.detector_error_model, num_distinct_weights, true, true); + auto mwpm_correlated = + pm::detector_error_model_to_mwpm(test_case.detector_error_model, num_distinct_weights, true, true); + + ASSERT_TRUE(graph_structure_equal(mwpm_correlated.flooder.graph, mwpm_correlated_untouched.flooder.graph)); + ASSERT_TRUE( + graph_structure_equal(mwpm_correlated.search_flooder.graph, mwpm_correlated_untouched.search_flooder.graph)); + + stim::SparseShot sparse_shot; + size_t num_mistakes = 0; + size_t num_mistakes_uncorrelated = 0; + size_t num_shots = 0; + size_t max_shots = 300; + size_t expected_mistakes_correlated = 5; + size_t expected_mistakes_uncorrelated = 11; + pm::ExtendedMatchingResult res(mwpm_correlated.flooder.graph.num_observables); + std::vector edges; + while (test_case.reader->start_and_read_entire_record(sparse_shot)) { + if (num_shots > max_shots) + break; + pm::decode_detection_events( + mwpm_correlated, sparse_shot.hits, res.obs_crossed.data(), res.weight, /*enable_correlations=*/true); + if (sparse_shot.obs_mask_as_u64() != res.obs_crossed[0]) { + num_mistakes++; + } + if (num_shots < 3) { + ASSERT_TRUE(graph_structure_equal(mwpm_correlated.flooder.graph, mwpm_correlated_untouched.flooder.graph)); + ASSERT_TRUE(graph_structure_equal( + mwpm_correlated.search_flooder.graph, mwpm_correlated_untouched.search_flooder.graph)); + } + if (sparse_shot.obs_mask_as_u64() != test_case.expected_obs_masks[num_shots]) { + num_mistakes_uncorrelated++; + } + pm::MatchingResult res_bitmask = pm::decode_detection_events_for_up_to_64_observables( + mwpm_correlated, sparse_shot.hits, /*enable_correlations=*/true); + ASSERT_EQ(res.obs_crossed[0], res_bitmask.obs_mask); + if (num_shots < 3) { + ASSERT_TRUE(graph_structure_equal(mwpm_correlated.flooder.graph, mwpm_correlated_untouched.flooder.graph)); + ASSERT_TRUE(graph_structure_equal( + mwpm_correlated.search_flooder.graph, mwpm_correlated_untouched.search_flooder.graph)); + } + pm::decode_detection_events_to_edges_with_edge_correlations(mwpm_correlated, sparse_shot.hits, edges); + auto obs_edge_corr = get_observables_from_edges(edges, mwpm_correlated); + auto edges_syndrome = get_syndrome_from_edges(edges); + ASSERT_EQ(res.obs_crossed[0], obs_edge_corr); + ASSERT_EQ(edges_syndrome, sparse_shot.hits); + if (num_shots < 3) { + ASSERT_TRUE(graph_structure_equal(mwpm_correlated.flooder.graph, mwpm_correlated_untouched.flooder.graph)); + ASSERT_TRUE(graph_structure_equal( + mwpm_correlated.search_flooder.graph, mwpm_correlated_untouched.search_flooder.graph)); + } + edges.clear(); + sparse_shot.clear(); + num_shots++; + std::fill(res.obs_crossed.begin(), res.obs_crossed.end(), 0); + res.weight = 0; + } + ASSERT_TRUE(graph_structure_equal(mwpm_correlated.flooder.graph, mwpm_correlated_untouched.flooder.graph)); + ASSERT_TRUE( + graph_structure_equal(mwpm_correlated.search_flooder.graph, mwpm_correlated_untouched.search_flooder.graph)); + ASSERT_LT(num_mistakes, num_mistakes_uncorrelated); + ASSERT_EQ(num_mistakes, expected_mistakes_correlated); + ASSERT_EQ(num_mistakes_uncorrelated, expected_mistakes_uncorrelated); +} + TEST(MwpmDecoding, CompareSolutionWeightsWithNoLimitOnNumObservables) { DecodingTestCase test_case; for (int q : {0, 1}) { @@ -194,54 +456,6 @@ TEST(MwpmDecoding, DecodeToMatchEdges) { } } -std::vector get_syndrome_from_edges(const std::vector& edges) { - std::set syndrome; - for (size_t i = 0; i < edges.size() / 2; i++) { - int64_t u = edges[2 * i]; - int64_t v = edges[2 * i + 1]; - - auto u_it = syndrome.find(u); - if (u_it == syndrome.end()) { - syndrome.insert(u); - } else { - syndrome.erase(u_it); - } - - if (v != -1) { - auto v_it = syndrome.find(v); - if (v_it == syndrome.end()) { - syndrome.insert(v); - } else { - syndrome.erase(v_it); - } - } - } - std::vector sorted_syndrome; - for (auto& s : syndrome) - sorted_syndrome.push_back(s); - return sorted_syndrome; -} - -uint64_t get_observables_from_edges(const std::vector& edges, pm::Mwpm& mwpm) { - uint64_t obs_mask = 0; - for (size_t i = 0; i < edges.size() / 2; i++) { - int64_t u = edges[2 * i]; - int64_t v = edges[2 * i + 1]; - - auto& u_node = mwpm.search_flooder.graph.nodes[u]; - size_t idx = SIZE_MAX; - if (v == -1) { - idx = 0; - } else { - auto v_ptr = &mwpm.search_flooder.graph.nodes[v]; - idx = u_node.index_of_neighbor(v_ptr); - } - for (auto& obs : u_node.neighbor_observable_indices[idx]) - obs_mask ^= 1 << obs; - } - return obs_mask; -} - TEST(MwpmDecoding, DecodeToEdges) { DecodingTestCase test_case; for (int q : {0, 1}) { diff --git a/src/pymatching/sparse_blossom/flooder/graph.cc b/src/pymatching/sparse_blossom/flooder/graph.cc index 3950c3f6c..5c1b8850d 100644 --- a/src/pymatching/sparse_blossom/flooder/graph.cc +++ b/src/pymatching/sparse_blossom/flooder/graph.cc @@ -18,6 +18,7 @@ #include #include +#include "graph.h" #include "pymatching/sparse_blossom/driver/implied_weights.h" #include "pymatching/sparse_blossom/flooder_matcher_interop/mwpm_event.h" diff --git a/src/pymatching/sparse_blossom/search/search_graph.cc b/src/pymatching/sparse_blossom/search/search_graph.cc index ec1b0d382..d4be3ae5d 100644 --- a/src/pymatching/sparse_blossom/search/search_graph.cc +++ b/src/pymatching/sparse_blossom/search/search_graph.cc @@ -113,9 +113,13 @@ void pm::SearchGraph::reweight_for_edges(const std::vector& edges) { reweight_for_edge(u, v); } } + void pm::SearchGraph::undo_reweights() { - for (auto& [ptr, weight] : previous_weights) { - *ptr = weight; + // We iterate backward over the previous weights, since some edges + // may have been reweighted more than once. + for (auto it = previous_weights.rbegin(); it != previous_weights.rend(); ++it) { + pm::PreviousWeight& prev = *it; + *prev.ptr = prev.val; } previous_weights.clear(); } diff --git a/tests/matching/decode_test.py b/tests/matching/decode_test.py index c72465932..6f37fe56c 100644 --- a/tests/matching/decode_test.py +++ b/tests/matching/decode_test.py @@ -212,17 +212,30 @@ def test_surface_code_solution_weights(data_dir: Path): ) assert np.allclose(bitpacked_batch_weights, expected_weights, rtol=1e-8) + +def test_surface_code_solution_weights_with_correlations(data_dir: Path): + stim = pytest.importorskip("stim") + dem = stim.DetectorErrorModel.from_file( + data_dir / "surface_code_rotated_memory_x_13_0.01.dem" + ) + m = Matching.from_detector_error_model(dem) + shots = stim.read_shot_data_file( + path=data_dir / "surface_code_rotated_memory_x_13_0.01_1000_shots.b8", + format="b8", + num_detectors=m.num_detectors, + num_observables=m.num_fault_ids, + ) # Test correlated decoding + corr_weights_path = data_dir / "surface_code_rotated_memory_x_13_0.01_1000_shots_no_buckets_weights_pymatching_correlated.txt" + corr_predictions_path = data_dir / "surface_code_rotated_memory_x_13_0.01_1000_shots_no_buckets_predictions_pymatching_correlated.txt" with open( - data_dir - / "surface_code_rotated_memory_x_13_0.01_1000_shots_no_buckets_weights_pymatchingv2.2.2_correlated.txt", + corr_weights_path, "r", encoding="utf-8", ) as f: expected_corr_weights = [float(w) for w in f.readlines()] with open( - data_dir - / "surface_code_rotated_memory_x_13_0.01_1000_shots_no_buckets_predictions_pymatchingv2.2.2_correlated.txt", + corr_predictions_path, "r", encoding="utf-8", ) as f: @@ -237,6 +250,21 @@ def test_surface_code_solution_weights(data_dir: Path): return_weights=True, enable_correlations=True, ) + # # Uncomment to update data files + # with open( + # corr_weights_path, + # "w", + # encoding="utf-8", + # ) as f: + # for w in corr_weights: + # print(w, file=f) + # with open( + # corr_predictions_path, + # "w", + # encoding="utf-8", + # ) as f: + # for pred in corr_predictions: + # print(pred[0], file=f) assert np.array_equal(corr_predictions, expected_corr_observables_arr) assert np.allclose(corr_weights, expected_corr_weights, rtol=1e-8)