@@ -361,10 +361,10 @@ def test_predecoded_backward_compat():
361361def test_predecoded_unionfind_name ():
362362 code = codes .repetition_code (5 )
363363 c2q , nq = code .check_to_qubits , code .n_qubits
364- # PredecodedDecoder accepts positional decoder name
364+ # PredecodedDecoder accepts positional decoder name (canonical: "union_find")
365365 from qector_decoder_v3 import PredecodedDecoder as PDC
366366
367- dec = PDC (c2q , nq , "unionfind " )
367+ dec = PDC (c2q , nq , "union_find " )
368368 # Should decode without error
369369 H = code .parity_check_matrix ()
370370 syndrome = np .zeros (len (c2q ), dtype = np .uint8 )
@@ -375,15 +375,31 @@ def test_predecoded_unionfind_name():
375375# =====================================================================
376376# 11. BELIEF MATCHING
377377# =====================================================================
378- def test_belief_matching_from_numpy_h ():
379- H = np .array ([[1 , 1 , 0 ], [0 , 1 , 1 ]], dtype = np .uint8 )
380- bm = BeliefMatching .from_numpy_h (H )
378+ def test_belief_matching_from_stim_circuit ():
379+ import stim
380+ circuit = stim .Circuit ("""
381+ R 0 1 2
382+ CX 0 1
383+ CX 1 2
384+ M 0 1 2
385+ DETECTOR rec[-3] rec[-2]
386+ DETECTOR rec[-2] rec[-1]
387+ """ )
388+ bm = BeliefMatching .from_stim_circuit (circuit )
381389 assert bm is not None
382390
383391
384392def test_belief_matching_decode ():
385- H = np .array ([[1 , 1 , 0 ], [0 , 1 , 1 ]], dtype = np .uint8 )
386- bm = BeliefMatching .from_numpy_h (H , [0.08 , 0.08 , 0.08 ])
393+ import stim
394+ circuit = stim .Circuit ("""
395+ R 0 1 2
396+ CX 0 1
397+ CX 1 2
398+ M 0 1 2
399+ DETECTOR rec[-3] rec[-2]
400+ DETECTOR rec[-2] rec[-1]
401+ """ )
402+ bm = BeliefMatching .from_stim_circuit (circuit )
387403 syndrome = np .array ([1 , 0 ], dtype = np .uint8 )
388404 try :
389405 corr = bm .decode (syndrome )
@@ -399,7 +415,7 @@ def test_auto_decoder_select():
399415 code = codes .repetition_code (5 )
400416 c2q , nq = code .check_to_qubits , code .n_qubits
401417 auto = AutoDecoder (c2q , nq )
402- selected = auto .auto_select ( c2q , nq )
418+ selected = auto .select ( 1024 ) # select backend for batch_size=1024
403419 assert isinstance (selected , str ) and len (selected ) > 0
404420
405421
0 commit comments