Skip to content

Ifs to stim partial

IfToStimPartial dataclass

IfToStimPartial()

Bases: RewriteRule

Rewrite measurement-conditioned IfElse using GetRecIdxFromPredicate.

Accepts the Bool condition directly (result of IsOne/IsZero) and creates GetRecIdxFromPredicate -> GetRecord -> CX/CY/CZ. If the body contains multiple Pauli gates, splits into multiple controlled gates sharing the same GetRecord result.