py_alqorithms.single_measurement_circuit
- py_alqorithms.single_measurement_circuit(pauli_products, readout_register, undo_basis_rotation, number_qubits, qubit_mapping=None, definitionbit_length=None)
Create a measurement circuit using single projective measurements on 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 than performs a single projective Z-Basis Measurement on each qubit, writing the result to an output register.
Optionally the basis rotations can be undone after the measurement.
- Parameters:
pauli_products (List[PauliProduct]) -- The PauliProducts that should be measured by the circuit
readout_register (str) -- Name of the readout-register
undo_basis_rotation (bool) -- Optional append operations undoing basis rotations
number_qubits -- The number of qubits in the operator to be measured
qubit_mapping (Optional[Dict[int, int]]) -- Optional qubit remapping to be applied in the measurement circuit.
definitionbit_length (Optional[int]) -- Optional length to set for the DefinitionBit operation.
- Returns:
the measurement circuit produced.
- Return type:
Circuit
- Raises:
PyTypeError -- Error converting the list of PauliProducts.
PyValueError -- PauliProducts can not be measured in same circuit with chosen method.