qml.qcut

This module contains quantum function transforms for cutting quantum circuits.

Overview

This module defines transform functions for circuit cutting. This allows for ‘cutting’ (or splitting) of large circuits into smaller circuits, to allow them to be executed on devices that have a restricted number of qubits.

Transforms for circuit cutting

cut_circuit(tape[, auto_cutter, …])

Cut up a quantum circuit into smaller circuit fragments.

cut_circuit_mc(tape[, …])

Cut up a circuit containing sample measurements into smaller fragments using a Monte Carlo method.

Utility functions

There are also low-level functions that can be used to build up the circuit cutting functionalities:

tape_to_graph(tape)

Converts a quantum tape to a directed multigraph.

replace_wire_cut_nodes(graph)

Replace each WireCut node in the graph with a MeasureNode and PrepareNode.

fragment_graph(graph)

Fragments a graph into a collection of subgraphs as well as returning the communication (quotient) graph.

graph_to_tape(graph)

Converts a directed multigraph to the corresponding QuantumTape.

expand_fragment_tape(tape)

Expands a fragment tape into a sequence of tapes for each configuration of the contained MeasureNode and PrepareNode operations.

expand_fragment_tapes_mc(tapes, …)

Expands fragment tapes into a sequence of random configurations of the contained pairs of MeasureNode and PrepareNode operations.

qcut_processing_fn(results, …[, …])

Processing function for the cut_circuit() transform.

qcut_processing_fn_sample(results, …)

Function to postprocess samples for the cut_circuit_mc() transform.

qcut_processing_fn_mc(results, …)

Function to postprocess samples for the cut_circuit_mc() transform.

CutStrategy([devices, max_free_wires, …])

A circuit-cutting distribution policy for executing (large) circuits on available (comparably smaller) devices.

kahypar_cut(graph, num_fragments[, …])

Calls KaHyPar to partition a graph.

place_wire_cuts(graph, cut_edges)

Inserts a WireCut node for each provided cut edge into a circuit graph.

find_and_place_cuts(graph[, cut_method, …])

Automatically finds and places optimal WireCut nodes into a given tape-converted graph using a customizable graph partitioning function.

Cutting Circuits

Circuit cutting can allow you to replace a circuit with N wires by a set of circuits with less than N wires (see also Peng et. al). This comes with a cost: the smaller circuits require a greater number of device executions to be evaluated.

In PennyLane, circuit cutting for circuits that terminate in expectation values can be activated by positioning WireCut operators at the desired cut locations, and by decorating the QNode with the cut_circuit() transform.

Cut circuits remain fully differentiable, and the resulting circuits can be executed on parallel devices if available. Please see the cut_circuit() documentation for more details.

Note

Simulated quantum circuits that produce samples can be cut using the cut_circuit_mc() transform, which is based on the Monte Carlo method.

Automatic cutting

PennyLane also has experimental support for automatic cutting of circuits — that is, the ability to determine optimum cut location without explicitly placing WireCut operators. This can be enabled by using the auto_cutter keyword argument of cut_circuit(); refer to the function documentation for more details.