quantumlib / Stim

A fast stabilizer circuit library.
Apache License 2.0
310 stars 90 forks source link

Fix `with_inlined_feedback` giving bad results when interleaving feedback and measurements #730

Closed Strilanc closed 4 months ago

Strilanc commented 4 months ago
c = stim.Circuit('''
    M 0
    CX
    M 1
    DETECTOR rec[-1]
''')
c.with_inlined_feedback()

prints

stim.Circuit('''
    M 1 0
    DETECTOR rec[-1]
''')

which is obviously wrong because it reversed the order of the measurements.