Skip to content

TN ​

Tensor-network contraction and ML decoding

11/11 passed in 89803ms

TestWhat it doesResult
test_beats_mwpm_with_correlationsWith depolarizing Y-correlations MLD beats MWPM, which decodes X/Z apart.✅ pass
test_bond_cap_on_toricOn a toric network chi=1 changes the class weights and reports dropped weight, while chi=64 restores the exact contraction and drops nothing.✅ pass
test_contract_matches_einsumContracting a small star network agrees with a direct numpy einsum.✅ pass
test_knobs_match_exact_batchOn sampled rotated-surface d=3 shots a bond cap of 16 and a memory budget of 64 both decode every shot like the exact contraction.✅ pass
test_matches_brute_forceMLD, bond-capped MLD and sliced MLD each reproduce brute-force maximum likelihood on every repetition-code syndrome.✅ pass
test_memory_budget_bounds_the_peakA budget below the exact peak slices, and the largest intermediate then fits the budget, which a bond cap alone does not promise.✅ pass
test_never_worse_than_mwpmOn a graphlike surface code MLD is never worse than MWPM (it is optimal).✅ pass
test_parity_matches_oracleThe dense XOR node and, past 8 legs, the chained factorisation both equal an independent XOR table at either target.✅ pass
test_truncated_runs_at_distance_fiveA bonded MLD decodes rotated-surface d=5, where the exact contraction's treewidth would explode.✅ pass
test_truncation_and_slicingA bond cap covering the cut and slicing a shared leg leave a random network's contraction exact, while chi=1 below the cut's rank changes it.✅ pass
test_truncation_drop_is_no_boundtruncation_drop is a diagnostic, not a bound on the contraction's error: on a doubled amplitude-damping network a chi=2 cap moves the class weights by more than the weight it reports dropping.✅ pass