py_alqorithms.repeated_measurement_circuit

py_alqorithms.repeated_measurement_circuit(pauli_products, readout_register, number_qubits, number_measurements, qubit_mapping=None)

Create a measurement circuit using repeated measurements on all qubits.

The circuit can measure several PauliProducts at the same time using basis rotations, as long as the PauliProducts are compatible. Two PauliProducts are compatible if for each qubit (or spin) in the PauliProduct the both PauliProducts have either the same PauliOperator (X, Y, Z) or at least one has the identity I.

The function returns an error when the PauliProducts are not compatible.

The resulting circuit will rotate each qubit into a new basis so that a Z-Measurement will be equivalent to a X, Y or Z measurement in the original basis, depending on which Pauli Operator is supposed to be measured.

It then inserts a repeated-measurement Pragma measuring all qubits.

Parameters:
  • pauli_products (List[PauliProduct]) -- The PauliProducts that should be measured by the circuit

  • readout_register (str) -- Name of the readout-register

  • number_qubits (int) -- The total number of qubits in the device, used for measurement register

  • numper_measurements (int) -- The number of times the circuit and measurement are repeated

  • qubit_mapping (Optional[Dict[int, int]]) -- Optional qubit remapping to be applied in the measurement circuit

Returns:

the measurement circuit produced.

Return type:

Circuit

Raises:
  • PyTypeError -- Error converting the list of PauliProducts.

  • PyValueError -- Length of PauliProduct exceeds length of measurement register.

  • PyValueError -- PauliProducts can not be measured in same circuit with chosen method.