Built-in quantum instructions¶
This section describes built-in non-unitary operations.
reset qubit|qubit; resets a qubit or quantum register to the state
\(|0\rangle\). This corresponds to a partial trace over those qubits
(i.e. discarding them) before replacing them with
\(|0\rangle\langle 0|\). Reset is shown in Fig. 4.
// Initialize and reset a register of 10 qubits qubit qubits; reset qubits;
bit|bit = measure qubit|qreg; measures the qubit(s) in the \(Z\)-basis and assigns
the measurement outcome(s) to the target bit(s). For backwards
compatibility this is equivalent to
measure qubit|qubit -> bit|bit; which is also supported. Measurement
corresponds to a projection onto one of the eigenstates of \(Z\),
and qubit(s) are immediately available for further quantum computation.
Both arguments must be register-type, or both must be bit-type. If both
arguments are register-type and have the same size, the statement
b = measure a;
b[j] = measure a[j]; for each index
j into register
a. Measurement is shown in
// Initialize, flip and measure a register of 10 qubits qubit qubits; bit bits; x qubits; bits = measure qubits;