py_alqorithms.measure_spin_operator_map

py_alqorithms.measure_spin_operator_map(input_operators, operator_names, constant_circuit=None, number_measurements=None, qubit_mapping=None, readout_register=None, definitionbit_length=None)

Take a list of PauliOperators and apply an optimised PauliZ-basis measurement of all of the terms in it.

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

  • operator_names (List[str]) -- The names of the operators to be measured

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

  • number_measurements (int) -- Optional number of measurements. If None, the code will perform a single measurement circuit. If Some(x), the code will perform x repeated measurements of the measurement circuit.

  • 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. If none is specified, ro will be used.

  • definitionbit_length (Optional[int]) -- Optional length to set for the DefinitionBit operation.

Returns:

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

Return type:

PauliZProduct

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