Chunk.time_reversed() is a very handy way to time-reverse any stim circuit, including the measurements and detectors. However, it does not handle noisy measurement gates M(0.01) 1 2 3.
Example:
import stim, stimflow as sf
c = stim.Circuit('''
R 0 1
X_ERROR(0.01) 0 1
H 0
CNOT 0 1
M(0.02) 0 1
DETECTOR rec[-1] rec[-2]
''')
c_rev = sf.Chunk(c, flows=[], q2i={}).time_reversed().circuit
print(c_rev)
Actual output:
M(0.02) 1 0 <- This line is wrong
CX 0 1
H 0
X_ERROR(0.01) 0 1
M 1 0
DETECTOR rec[-2]
Expected output:
R 1 0
X_ERROR(0.02) 1 0
CX 0 1
H 0
X_ERROR(0.01) 0 1
M 1 0
DETECTOR rec[-2]
Tested with
Python 3.10.18
stim==1.16.0
stimflow==1.17.dev1784161823
Chunk.time_reversed()is a very handy way to time-reverse any stim circuit, including the measurements and detectors. However, it does not handle noisy measurement gatesM(0.01) 1 2 3.Example:
Actual output:
Expected output:
Tested with