Ifs to stim
IfElseSimplification
dataclass
IfElseSimplification()
contains_ifelse
contains_ifelse(stmt: IfElse) -> bool
Check if the IfElse statement contains another IfElse statement.
Source code in .venv/lib/python3.12/site-packages/bloqade/stim/rewrite/ifs_to_stim.py
33 34 35 36 37 38 | |
has_else_body
has_else_body(stmt: IfElse) -> bool
Check if the IfElse statement has an else body.
Source code in .venv/lib/python3.12/site-packages/bloqade/stim/rewrite/ifs_to_stim.py
55 56 57 58 59 60 61 62 63 | |
is_nested_ifelse
is_nested_ifelse(stmt: IfElse) -> bool
Check if the IfElse statement is nested.
Source code in .venv/lib/python3.12/site-packages/bloqade/stim/rewrite/ifs_to_stim.py
43 44 45 46 47 48 49 50 51 52 53 | |
IfToStim
dataclass
IfToStim(measure_frame: MeasureIDFrame)
StimSplitIfStmts
dataclass
StimSplitIfStmts()
Bases: IfElseSimplification, SplitIfStmts
Splits the then body of an if-else statement into multiple if statements
Given an IfElse with multiple valid statements in the then-body:
if measure_result
squin.x(q0) squin.y(q1)
this should be rewritten to:
if measure_result
squin.x(q0)
if measure_result
squin.y(q1)