qml.qcut.qcut_processing_fn_mc

qcut_processing_fn_mc(results, communication_graph, settings, shots, classical_processing_fn)[source]

Function to postprocess samples for the cut_circuit_mc() transform. This takes a user-specified classical function to act on bitstrings and generates an expectation value.

Note

This function is designed for use as part of the sampling-based circuit cutting workflow. Check out the qml.cut_circuit_mc() transform for more details.

Parameters
  • results (Sequence) – a collection of sample-based execution results generated from the random expansion of circuit fragments over measurement and preparation node configurations

  • communication_graph (nx.MultiDiGraph) – the communication graph determining connectivity between circuit fragments

  • settings (np.ndarray) – Each element is one of 8 unique values that tracks the specific measurement and preparation operations over all configurations. The number of rows is determined by the number of cuts and the number of columns is determined by the number of shots.

  • shots (int) – the number of shots

  • classical_processing_fn (callable) – A classical postprocessing function to be applied to the reconstructed bitstrings. The expected input is a bitstring; a flat array of length wires and the output should be a single number within the interval \([-1, 1]\).

Returns

the expectation value calculated in accordance to Eq. (35) of Peng et al.

Return type

float or tensor_like