Mid-Circuit Measurement
Syntax
- Python
- Native
measure ( quantum-var )
Semantics
- A
measurecall receives a quantum variable of typeQBitand returns aCBoolvalue. - In Qmod Native, when
measureis called, it must be immediately be assigned to a local classical variable, e.g.,x = measure(q);. - Measurements are run-time
values. Currently,
ifis the only control flow statements that supports run-time variables. - Following the
measureoperation, any superposition state of its operand collapses to a computational-basis state corresponding to the classical measured result.
Example
The following function implements theRESET gate using a mid-circuit
measurement.
- Python
- Native