qml.qcut.qcut_processing_fn

qcut_processing_fn(results, communication_graph, prepare_nodes, measure_nodes, use_opt_einsum=False)[source]

Processing function for the cut_circuit() transform.

Note

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

Parameters
  • results (Sequence[Sequence]) – A collection of execution results generated from the expansion of circuit fragments over measurement and preparation node configurations. These results are processed into tensors and then contracted.

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

  • prepare_nodes (Sequence[Sequence[PrepareNode]]) – a sequence of size len(communication_graph.nodes) that determines the order of preparation indices in each tensor

  • measure_nodes (Sequence[Sequence[MeasureNode]]) – a sequence of size len(communication_graph.nodes) that determines the order of measurement indices in each tensor

  • use_opt_einsum (bool) – Determines whether to use the opt_einsum package. This package is useful for faster tensor contractions of large networks but must be installed separately using, e.g., pip install opt_einsum. Both settings for use_opt_einsum result in a differentiable contraction.

Returns

the output of the original uncut circuit arising from contracting the tensor network of circuit fragments

Return type

float or tensor_like