Insert ticks
InsertTicks
Bases: RewriteRule
flowchart TD
bloqade.stim.rewrite.insert_ticks.InsertTicks[InsertTicks]
click bloqade.stim.rewrite.insert_ticks.InsertTicks href "" "bloqade.stim.rewrite.insert_ticks.InsertTicks"
Insert a TICK after every Stim operation.
Operates on a lowered Stim circuit. After each operation statement (gate,
reset, measurement, or noise channel) a
:class:~bloqade.stim.dialects.auxiliary.stmts.Tick is inserted, so the
rendered diagram's columns follow program order rather than ASAP packing.
The rule is idempotent -- an operation already followed by a TICK is
left untouched -- so it is safe under :class:~kirin.rewrite.Fixpoint.
is_operation
staticmethod
is_operation(stmt: Statement) -> bool
Whether the statement is a moment-advancing Stim operation.
Source code in .venv/lib/python3.12/site-packages/bloqade/stim/rewrite/insert_ticks.py
27 28 29 30 | |
rewrite_Statement
rewrite_Statement(node: Statement) -> RewriteResult
Insert a TICK after node when it is an un-ticked operation.
Source code in .venv/lib/python3.12/site-packages/bloqade/stim/rewrite/insert_ticks.py
32 33 34 35 36 37 38 39 40 41 | |