Classical control
ClassicalIfCondition
dataclass
ClassicalIfCondition(
measure: Measure, trigger_on_one: bool
)
Parsed measurement condition for cirq classical control emission.
classical_control_for_condition
classical_control_for_condition(
key: str, condition: ClassicalIfCondition
) -> cirq.Condition
Build the cirq condition for condition using measurement key key.
Source code in .venv/lib/python3.12/site-packages/bloqade/cirq_utils/classical_control.py
165 166 167 168 169 170 171 172 173 174 | |
get_single_gate
get_single_gate(stmt: IfElse) -> gate.stmts.Gate | None
Return the sole gate in stmt's then-body, if present.
Source code in .venv/lib/python3.12/site-packages/bloqade/cirq_utils/classical_control.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
is_empty_else
is_empty_else(stmt: IfElse) -> bool
Return whether stmt has no executable else body.
Source code in .venv/lib/python3.12/site-packages/bloqade/cirq_utils/classical_control.py
120 121 122 123 124 125 126 127 128 129 | |
is_is_lost_condition
is_is_lost_condition(cond: SSAValue) -> bool
Return whether cond is based on is_lost.
Source code in .venv/lib/python3.12/site-packages/bloqade/cirq_utils/classical_control.py
110 111 112 113 114 115 116 117 | |
is_single_qubit_measure
is_single_qubit_measure(measure: Measure) -> bool
Return whether measure reads exactly one qubit.
Source code in .venv/lib/python3.12/site-packages/bloqade/cirq_utils/classical_control.py
61 62 63 64 65 66 | |
parse_classical_if_condition
parse_classical_if_condition(
cond: SSAValue,
) -> ClassicalIfCondition | None
Parse an IfElse condition supported by cirq classical control.
Source code in .venv/lib/python3.12/site-packages/bloqade/cirq_utils/classical_control.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |