quantumlib / Stim

A fast stabilizer circuit library.
Apache License 2.0
356 stars 105 forks source link

Add the ability to tag circuit instructions #848

Closed Strilanc closed 3 weeks ago

Strilanc commented 4 weeks ago
import stim
circuit = stim.Circuit("""
    R[mlr] 0 1
    TICK[200ns]

    H 0
    TICK[10ns]

    REPEAT[unroll] 3 {
        CZ[adiabatic] 0 1
        TICK[20ns]
    }

    H 0
    TICK[20ns]

    I[DYNAMIC_DECOUPLE_NEW_LATEST_VERSION_5_FINAL_ACTUALLY_FINAL_YXY] 2 3 4 5
    M[include_two_state] 0 1
    DETECTOR[subgraph_2] rec[-1] rec[-2]
""")
assert circuit[0].tag == "mlr"
assert circuit[1].tag == "200ns"
assert circuit[2].tag == ""

Fixes https://github.com/quantumlib/Stim/issues/843