py_alqorithms.measure_spin_operator_map_cheated

py_alqorithms.measure_spin_operator_map_cheated(input_operators, operator_names, constant_circuit=None, qubit_mapping=None, readout_register=None)

Take a PauliOperator/PauliHamiltonian and apply an optimised CheatedPauliZ-basis measurement of all of the terms in it.

The measurement is based on the PragmaGetPauliProduct operations that directly extract the expectation values of PauliProducts.

Parameters:
  • input_operators (List[PauliOperator]) -- The PauliOperators to be measured

  • operator_names (List[str]) -- Names of the measured operators

  • constant_circuit (Optional[Circuit]) -- Optional circuit to apply to all parts of the measurement, before the measurement circuits

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

  • readout_register (Optional[str]) -- Optional base name for the readout registers used to save the expectation values of Pauli products

Returns:

The CheatedPauliZProduct measurement struct populated with the circuits and inputs corresponding to the SpinOperator given

Return type:

CheatedPauliZProduct

Raises:
  • PyTypeError -- Could not convert list of PauliOperators.

  • PyTypeError -- Could not convert constant_circuit to Circuit.

  • PyValueError -- Issue in the add_operator_product function in struqture

  • PyValueError -- Issue in the float function in qoqo_calculator

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

  • PyValueError -- The two PauliProducts given are incompatible

  • PyValueError -- Issue in the add_pauliz_product function in roqoqo

  • PyValueError -- The name of expectation value is already taken