When I use stim to simulate d=3 Bacon-Shor's code, I can't find the problem with my circuits resulting in the weird DetectorErrorModel.
The initialization and stabilizer measurement circuits are as follow:
I focus on $|0\rangle _L$ memory simulation and choose not to use reset after measurement. So with three rounds of stabilizer measurements, the detectors are
...
DETECTOR(0, 0, 0) rec[-4]
DETECTOR(1, 0, 0) rec[-3]
...
SHIFT_COORDS(0, 0, 1)
DETECTOR(0, 0, 0) rec[-4]
DETECTOR(1, 0, 0) rec[-3]
...
SHIFT_COORDS(0, 0, 1)
DETECTOR(0, 0, 0) rec[-4] rec[-8]
DETECTOR(1, 0, 0) rec[-3] rec[-7]
...
DETECTOR(0, 0, 1) rec[-9] rec[-6] rec[-8] rec[-5] rec[-7] rec[-4] rec[-13] rec[-17]
DETECTOR(1, 0, 1) rec[-6] rec[-3] rec[-5] rec[-2] rec[-4] rec[-1] rec[-12] rec[-16]
some error I can't understand appear in auto-generated DetectorErrorModel like D0 D4 L0 ^ D1 D5 ^ L0
.
Here is my stim.Circuit
file and generated error_model:
circuit.txt
stim.Circuit('''
R 0 1 2 3 4 5 6 7 8 9 10 11 12
H 0
DEPOLARIZE1(0.001) 0
CX 0 1
DEPOLARIZE2(0.02) 0 1
CX 1 2
DEPOLARIZE2(0.02) 1 2
H 3
DEPOLARIZE1(0.001) 3
CX 3 4
DEPOLARIZE2(0.02) 3 4
CX 4 5
DEPOLARIZE2(0.02) 4 5
H 6
DEPOLARIZE1(0.001) 6
CX 6 7
DEPOLARIZE2(0.02) 6 7
CX 7 8
DEPOLARIZE2(0.02) 7 8
H 0
DEPOLARIZE1(0.001) 0
H 1
DEPOLARIZE1(0.001) 1
H 2
DEPOLARIZE1(0.001) 2
H 3
DEPOLARIZE1(0.001) 3
H 4
DEPOLARIZE1(0.001) 4
H 5
DEPOLARIZE1(0.001) 5
H 6
DEPOLARIZE1(0.001) 6
H 7
DEPOLARIZE1(0.001) 7
H 8
DEPOLARIZE1(0.001) 8 0 1 2 3 4 5 6 7 8
H 11
DEPOLARIZE1(0.001) 11
H 12
DEPOLARIZE1(0.001) 12
CX 11 0
DEPOLARIZE2(0.02) 11 0
CX 12 1
DEPOLARIZE2(0.02) 12 1
DEPOLARIZE1(0.002) 2 3 4 5 6 7 8
CX 11 1
DEPOLARIZE2(0.02) 11 1
CX 12 2
DEPOLARIZE2(0.02) 12 2
DEPOLARIZE1(0.002) 0 3 4 5 6 7 8
CX 11 3
DEPOLARIZE2(0.02) 11 3
CX 12 4
DEPOLARIZE2(0.02) 12 4
DEPOLARIZE1(0.002) 0 1 2 5 6 7 8
CX 11 4
DEPOLARIZE2(0.02) 11 4
CX 12 5
DEPOLARIZE2(0.02) 12 5
DEPOLARIZE1(0.002) 0 1 2 3 6 7 8
CX 11 6
DEPOLARIZE2(0.02) 11 6
CX 12 7
DEPOLARIZE2(0.02) 12 7
DEPOLARIZE1(0.002) 0 1 2 3 4 5 8
CX 11 7
DEPOLARIZE2(0.02) 11 7
CX 12 8
DEPOLARIZE2(0.02) 12 8
DEPOLARIZE1(0.002) 0 1 2 3 4 5 6
DEPOLARIZE1(0.001) 0 1 2 3 4 5 6 7 8
H 11
DEPOLARIZE1(0.001) 11
H 12
DEPOLARIZE1(0.001) 12
CX 0 9
DEPOLARIZE2(0.02) 0 9
CX 3 10
DEPOLARIZE2(0.02) 3 10
DEPOLARIZE1(0.002) 1 2 4 5 6 7 8 11 12
CX 3 9
DEPOLARIZE2(0.02) 3 9
CX 6 10
DEPOLARIZE2(0.02) 6 10
DEPOLARIZE1(0.002) 0 1 2 4 5 7 8 11 12
CX 1 9
DEPOLARIZE2(0.02) 1 9
CX 4 10
DEPOLARIZE2(0.02) 4 10
DEPOLARIZE1(0.002) 0 2 3 5 6 7 8 11 12
CX 4 9
DEPOLARIZE2(0.02) 4 9
CX 7 10
DEPOLARIZE2(0.02) 7 10
DEPOLARIZE1(0.002) 0 1 2 3 5 6 8 11 12
CX 2 9
DEPOLARIZE2(0.02) 2 9
CX 5 10
DEPOLARIZE2(0.02) 5 10
DEPOLARIZE1(0.002) 0 1 3 4 6 7 8 11 12
CX 5 9
DEPOLARIZE2(0.02) 5 9
CX 8 10
DEPOLARIZE2(0.02) 8 10
DEPOLARIZE1(0.002) 0 1 2 3 4 6 7 11 12
DEPOLARIZE1(0.01) 0 1 2 3 4 5 6 7 8
X_ERROR(0.05) 9
M 9
X_ERROR(0.05) 10
M 10
X_ERROR(0.05) 11
M 11
X_ERROR(0.05) 12
M 12
DETECTOR(0, 0, 0) rec[-4]
DETECTOR(1, 0, 0) rec[-3]
DEPOLARIZE1(0.001) 0 1 2 3 4 5 6 7 8 9 10
H 11
DEPOLARIZE1(0.001) 11
H 12
DEPOLARIZE1(0.001) 12
CX 11 0
DEPOLARIZE2(0.02) 11 0
CX 12 1
DEPOLARIZE2(0.02) 12 1
DEPOLARIZE1(0.002) 2 3 4 5 6 7 8 9 10
CX 11 1
DEPOLARIZE2(0.02) 11 1
CX 12 2
DEPOLARIZE2(0.02) 12 2
DEPOLARIZE1(0.002) 0 3 4 5 6 7 8 9 10
CX 11 3
DEPOLARIZE2(0.02) 11 3
CX 12 4
DEPOLARIZE2(0.02) 12 4
DEPOLARIZE1(0.002) 0 1 2 5 6 7 8 9 10
CX 11 4
DEPOLARIZE2(0.02) 11 4
CX 12 5
DEPOLARIZE2(0.02) 12 5
DEPOLARIZE1(0.002) 0 1 2 3 6 7 8 9 10
CX 11 6
DEPOLARIZE2(0.02) 11 6
CX 12 7
DEPOLARIZE2(0.02) 12 7
DEPOLARIZE1(0.002) 0 1 2 3 4 5 8 9 10
CX 11 7
DEPOLARIZE2(0.02) 11 7
CX 12 8
DEPOLARIZE2(0.02) 12 8
DEPOLARIZE1(0.002) 0 1 2 3 4 5 6 9 10
DEPOLARIZE1(0.001) 0 1 2 3 4 5 6 7 8 9 10
H 11
DEPOLARIZE1(0.001) 11
H 12
DEPOLARIZE1(0.001) 12
CX 0 9
DEPOLARIZE2(0.02) 0 9
CX 3 10
DEPOLARIZE2(0.02) 3 10
DEPOLARIZE1(0.002) 1 2 4 5 6 7 8 11 12
CX 3 9
DEPOLARIZE2(0.02) 3 9
CX 6 10
DEPOLARIZE2(0.02) 6 10
DEPOLARIZE1(0.002) 0 1 2 4 5 7 8 11 12
CX 1 9
DEPOLARIZE2(0.02) 1 9
CX 4 10
DEPOLARIZE2(0.02) 4 10
DEPOLARIZE1(0.002) 0 2 3 5 6 7 8 11 12
CX 4 9
DEPOLARIZE2(0.02) 4 9
CX 7 10
DEPOLARIZE2(0.02) 7 10
DEPOLARIZE1(0.002) 0 1 2 3 5 6 8 11 12
CX 2 9
DEPOLARIZE2(0.02) 2 9
CX 5 10
DEPOLARIZE2(0.02) 5 10
DEPOLARIZE1(0.002) 0 1 3 4 6 7 8 11 12
CX 5 9
DEPOLARIZE2(0.02) 5 9
CX 8 10
DEPOLARIZE2(0.02) 8 10
DEPOLARIZE1(0.002) 0 1 2 3 4 6 7 11 12
DEPOLARIZE1(0.01) 0 1 2 3 4 5 6 7 8
X_ERROR(0.05) 9
M 9
X_ERROR(0.05) 10
M 10
X_ERROR(0.05) 11
M 11
X_ERROR(0.05) 12
M 12
SHIFT_COORDS(0, 0, 1)
DETECTOR(0, 0, 0) rec[-4]
DETECTOR(1, 0, 0) rec[-3]
DEPOLARIZE1(0.001) 0 1 2 3 4 5 6 7 8 9 10
H 11
DEPOLARIZE1(0.001) 11
H 12
DEPOLARIZE1(0.001) 12
CX 11 0
DEPOLARIZE2(0.02) 11 0
CX 12 1
DEPOLARIZE2(0.02) 12 1
DEPOLARIZE1(0.002) 2 3 4 5 6 7 8 9 10
CX 11 1
DEPOLARIZE2(0.02) 11 1
CX 12 2
DEPOLARIZE2(0.02) 12 2
DEPOLARIZE1(0.002) 0 3 4 5 6 7 8 9 10
CX 11 3
DEPOLARIZE2(0.02) 11 3
CX 12 4
DEPOLARIZE2(0.02) 12 4
DEPOLARIZE1(0.002) 0 1 2 5 6 7 8 9 10
CX 11 4
DEPOLARIZE2(0.02) 11 4
CX 12 5
DEPOLARIZE2(0.02) 12 5
DEPOLARIZE1(0.002) 0 1 2 3 6 7 8 9 10
CX 11 6
DEPOLARIZE2(0.02) 11 6
CX 12 7
DEPOLARIZE2(0.02) 12 7
DEPOLARIZE1(0.002) 0 1 2 3 4 5 8 9 10
CX 11 7
DEPOLARIZE2(0.02) 11 7
CX 12 8
DEPOLARIZE2(0.02) 12 8
DEPOLARIZE1(0.002) 0 1 2 3 4 5 6 9 10
DEPOLARIZE1(0.001) 0 1 2 3 4 5 6 7 8 9 10
H 11
DEPOLARIZE1(0.001) 11
H 12
DEPOLARIZE1(0.001) 12
CX 0 9
DEPOLARIZE2(0.02) 0 9
CX 3 10
DEPOLARIZE2(0.02) 3 10
DEPOLARIZE1(0.002) 1 2 4 5 6 7 8 11 12
CX 3 9
DEPOLARIZE2(0.02) 3 9
CX 6 10
DEPOLARIZE2(0.02) 6 10
DEPOLARIZE1(0.002) 0 1 2 4 5 7 8 11 12
CX 1 9
DEPOLARIZE2(0.02) 1 9
CX 4 10
DEPOLARIZE2(0.02) 4 10
DEPOLARIZE1(0.002) 0 2 3 5 6 7 8 11 12
CX 4 9
DEPOLARIZE2(0.02) 4 9
CX 7 10
DEPOLARIZE2(0.02) 7 10
DEPOLARIZE1(0.002) 0 1 2 3 5 6 8 11 12
CX 2 9
DEPOLARIZE2(0.02) 2 9
CX 5 10
DEPOLARIZE2(0.02) 5 10
DEPOLARIZE1(0.002) 0 1 3 4 6 7 8 11 12
CX 5 9
DEPOLARIZE2(0.02) 5 9
CX 8 10
DEPOLARIZE2(0.02) 8 10
DEPOLARIZE1(0.002) 0 1 2 3 4 6 7 11 12
DEPOLARIZE1(0.01) 0 1 2 3 4 5 6 7 8
X_ERROR(0.05) 9
M 9
X_ERROR(0.05) 10
M 10
X_ERROR(0.05) 11
M 11
X_ERROR(0.05) 12
M 12
SHIFT_COORDS(0, 0, 1)
DETECTOR(0, 0, 0) rec[-4] rec[-8]
DETECTOR(1, 0, 0) rec[-3] rec[-7]
X_ERROR(0.05) 0
M 0
X_ERROR(0.05) 1
M 1
X_ERROR(0.05) 2
M 2
X_ERROR(0.05) 3
M 3
X_ERROR(0.05) 4
M 4
X_ERROR(0.05) 5
M 5
X_ERROR(0.05) 6
M 6
X_ERROR(0.05) 7
M 7
X_ERROR(0.05) 8
M 8
DEPOLARIZE1(0.01) 9 10 11 12
DETECTOR(0, 0, 1) rec[-9] rec[-6] rec[-8] rec[-5] rec[-7] rec[-4] rec[-13] rec[-17]
DETECTOR(1, 0, 1) rec[-6] rec[-3] rec[-5] rec[-2] rec[-4] rec[-1] rec[-12] rec[-16]
OBSERVABLE_INCLUDE(0) rec[-9] rec[-8] rec[-7]
''')
error_model.txt
stim.DetectorErrorModel('''
error(0.07819) D0 D2
error(0.102128) D0 D4 L0
error(0.102128) D0 D4 L0 ^ D1 D5 ^ L0
error(0.0313222) D0 D4 L0 ^ D3 D5 ^ L0
error(0.07819) D1 D3
error(0.105303) D1 D5
error(0.0860003) D2
error(0.108379) D2 D4 L0
error(0.117794) D2 D4 L0 ^ D3 D5 ^ L0
error(0.0159144) D2 D4 L0 ^ D5 ^ L0
error(0.0860003) D3
error(0.108379) D3 D5
error(0.117794) D4 D5
error(0.0159144) D4 D5 ^ D2
error(0.07239) D4 D6
error(0.0313222) D4 D7
error(0.120844) D4 L0
error(0.0159144) D4 L0 ^ D2
error(0.120844) D5
error(0.07239) D5 D7
error(0.0159144) D5 ^ D3
error(0.166418) D6 D7
error(0.169079) D6 L0
error(0.0159144) D6 L0 ^ D4 L0
error(0.166418) D7
error(0.0159144) D7 ^ D5
detector(0, 0, 0) D0
detector(1, 0, 0) D1
shift_detectors(0, 0, 1) 0
detector(0, 0, 0) D2
detector(1, 0, 0) D3
shift_detectors(0, 0, 1) 0
detector(0, 0, 0) D4
detector(1, 0, 0) D5
detector(0, 0, 1) D6
detector(1, 0, 1) D7
''')
(Sorry for I did not combine some same-type gates into one line so it's a little uncomfortable to read.) I'm not sure whether I made some mistakes in writing the circuits or there is any error mechanism I'm not aware of.
D0 D1 D4 D5
. When I set only 2 detectors every cycle for Z stabilizer measurement, I think the number of symptoms caused by any single error should be no more than 2. – Inm Jan 29 '22 at 08:51match_errors
command line mode where it lists the circuit errors that cause dem errors. They'll be a python method for it, soon. Keep in mind you haveDEPOLARIZE2
operations, which have a YY term and each Y term can causes two detection events. And furthermore, using six cnots to measure a stabilizer means that if error occurs on the measurement qubit halfway through that process, it will kick out onto three separate data qubits. The only reason you don't have worse errors is there's only four stabilizers to flip! – Craig Gidney Jan 29 '22 at 14:12explain_error
in python api, it's really helpful, Thanks! – Inm Jan 30 '22 at 06:48