autoqasm.instructions.measurements module
Quantum measurement on qubits.
Example of measuring qubit 0:
@aq.main
def my_program():
measure(0)
- autoqasm.instructions.measurements.measure(qubits: int | str | Qubit | _ClassicalVar | OQPyExpression | Qubit | Iterable[int | str | Qubit | _ClassicalVar | OQPyExpression | Qubit] | None = None) BitVar[source]
Add qubit measurement statements to the program and assign the measurement results to bit variables.
- Parameters:
qubits (QubitIdentifierType | Iterable[QubitIdentifierType] | None) – The target qubits to measure. If None, all qubits will be measured. Default is None.
- Returns:
BitVar – Bit variable the measurement results are assigned to.
- autoqasm.instructions.measurements.measure_ff(target: int | str | Qubit | _ClassicalVar | OQPyExpression | Qubit, feedback_key: int, **kwargs) None[source]
Measure a qubit and store its result under a classical feedback key.
The measurement result is not bound to a Python variable; instead it is stored by the runtime under the integer
feedback_keyso that it can be consumed later in the same program by a classically-controlled operation such asautoqasm.instructions.cc_prx().This is an IQM experimental capability. See
braket.experimental_capabilities.iqm.classical_control.MeasureFFfor the corresponding Braket SDK surface.- Parameters:
target (QubitIdentifierType) – The qubit to measure.
feedback_key (int) – Integer key under which the measurement result is recorded. Must match the
feedback_keypassed to any subsequentcc_prxcall that depends on this measurement.