cirq.google.XmonStepResult.sample_measurement_ops

XmonStepResult.sample_measurement_ops(measurement_ops: List[cirq.ops.gate_operation.GateOperation], repetitions: int = 1) → Dict[str, List[List[bool]]]

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

Note that this does not collapse the wave function.

In contrast to sample which samples qubits, this takes a list of
cirq.GateOperation instances whose gates are cirq.MeasurementGate
instances and then returns a mapping from the key in the measurement
gate to the resulting bit strings. Different measurement operations must
not act on the same qubits.
Parameters:
  • measurement_opsGateOperation instances whose gates are MeasurementGate instances to be sampled form.
  • repetitions – The number of samples to take.
Returns: A dictionary from the measurement gate keys to the measurement
results. These results are lists of lists, with the outer list corresponding to repetitions and the inner list corresponding to the qubits acted upon by the measurement operation with the given key.
Raises:ValueError – If the operation’s gates are not MeasurementGate instances or a qubit is acted upon multiple times by different operations from measurement_ops.