Stim icon indicating copy to clipboard operation
Stim copied to clipboard

Add tick slicing to circuits

Open Strilanc opened this issue 1 year ago • 1 comments

Something like circuit.tick_slice(3, 20) which returns everything starting from tick 3 ending at tick 20.

Need to decide on the inclusion/exclusion semantics carefully. Is there an implicit tick at the start of the circuit?

Strilanc avatar May 06 '24 04:05 Strilanc

only-mostly-tongue-in-cheek: tick means fence post, so tock should mean fence stringer. after that just use python inclusion semantics

c = stim.Circuit("""
R 0     # TOCK 0
TICK    # TICK 0
H 0     # TOCK 1
TICK    # TICK 1
H 0     # TOCK 2
S 0     # ^
TICK    # TICK 2
M 0     # TOCK 3
""")

c.tick_slice(0, 2) -> stim.Circuit("""
TICK    # TICK 0
H 0     # TOCK 1
TICK    # TICK 1
H 0     # TOCK 2
S 0     # ^
""")

c.tock_slice(1,3) -> stim.Circuit("""
R 0     # TOCK 0
TICK    # TICK 0
H 0     # TOCK 1
TICK    # TICK 1
H 0     # TOCK 2
S 0     # ^
TICK    # TICK 2
""")

This has the other advantage of letting us complicate https://github.com/quantumlib/Stim/issues/739 as well (although actually whatever we decide for tick_slice should probably be the same convention se use for both diagrams)

ghost avatar May 08 '24 17:05 ghost