Function measure

Source
pub unsafe extern "C" fn measure(
    qureg: Qureg,
    measureQubit: c_int,
) -> c_int
Expand description

Measures a single qubit, collapsing it randomly to 0 or 1.

Outcome probabilities are weighted by the state vector, which is irreversibly changed after collapse to be consistent with the outcome.

The random outcome generator is seeded by seedQuESTDefault() within createQuESTEnv(), unless later overridden by seedQuEST().

@see

  • measureWithStats()
  • collapseToOutcome()
  • seedQuEST()
  • seedQuESTDefault()

@ingroup normgate @param[in, out] qureg object representing the set of all qubits @param[in] measureQubit qubit to measure @return the measurement outcome, 0 or 1 @throws invalidQuESTInputError()

  • if \p measureQubit is outside [0, \p qureg.numQubitsRepresented) @author Ania Brown (state-vector) @author Tyson Jones (density matrix)