cirq.measure(*target: cirq.Qid, key: Optional[str] = None, invert_mask: Tuple[bool, ...] = ()) → cirq.ops.raw_types.Operation[source]

Returns a single MeasurementGate applied to all the given qubits.

The qubits are measured in the computational basis.

  • *target – The qubits that the measurement gate should measure.

  • key – The string key of the measurement. If this is None, it defaults to a comma-separated list of the target qubits’ str values.

  • invert_mask – A list of Truthy or Falsey values indicating whether the corresponding qubits should be flipped. None indicates no inverting should be done.


An operation targeting the given qubits with a measurement.


ValueError if the qubits are not instances of Qid.