cirq.SimulatorStep.sample

SimulatorStep.sample(qubits: List[cirq.ops.raw_types.QubitId], repetitions: int = 1) → List[List[bool]][source]

Samples from the wave function at this point in the computation.

Note that this does not collapse the wave function.

Parameters:
  • qubits – The qubits to be sampled in an order that influence the returned measurement results.
  • repetitions – The number of samples to take.
Returns:

Measurement results with True corresponding to the |1⟩ state. The outer list is for repetitions, and the inner corresponds to measurements ordered by the supplied qubits. These lists are wrapped as an numpy ndarray.