autoqasm.operators.control_flow module
Operators for control flow constructs (e.g. if, for, while).
- autoqasm.operators.control_flow.for_stmt(iter: Iterable | Range | Qubit, extra_test: Callable[[], Any] | None, body: Callable[[Any], None], get_state: Any, set_state: Any, symbol_names: Any, opts: dict) None[source]
Implements a for loop.
- Parameters:
iter (Iterable | Range | Qubit) – The iterable to be looped over.
extra_test (Callable[[], Any] | None) – A function to cause the loop to break if true.
body (Callable[[Any], None]) – The body of the for loop.
get_state (Any) – Unused.
set_state (Any) – Unused.
symbol_names (Any) – Unused.
opts (dict) – Options of the for loop.
- autoqasm.operators.control_flow.while_stmt(test: Callable[[], Any], body: Callable[[], None], get_state: Any, set_state: Any, symbol_names: Any, opts: dict) None[source]
Implements a while loop.
- Parameters:
test (Callable[[], Any]) – The condition of the while loop.
body (Callable[[], None]) – The body of the while loop.
get_state (Any) – Unused.
set_state (Any) – Unused.
symbol_names (Any) – Unused.
opts (dict) – Options of the while loop.
- autoqasm.operators.control_flow.if_stmt(cond: Any, body: Callable[[], Any], orelse: Callable[[], Any], get_state: Any, set_state: Any, symbol_names: Any, nouts: int) None[source]
Implements an if/else statement.
- Parameters:
cond (Any) – The condition of the if statement.
body (Callable[[], Any]) – The contents of the if block.
orelse (Callable[[], Any]) – The contents of the else block.
get_state (Any) – Unused.
set_state (Any) – Unused.
symbol_names (Any) – Unused.
nouts (int) – The number of outputs from the if block.