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 up a quantum circuit into smaller circuit fragments. |
|
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:
|
Converts a quantum tape to a directed multigraph. |
|
Replace each |
|
Fragments a graph into a collection of subgraphs as well as returning the communication (quotient) graph. |
|
Converts a directed multigraph to the corresponding |
|
Expands a fragment tape into a sequence of tapes for each configuration of the contained |
|
Expands fragment tapes into a sequence of random configurations of the contained pairs of |
|
Processing function for the |
|
Function to postprocess samples for the |
|
Function to postprocess samples for the |
|
A circuit-cutting distribution policy for executing (large) circuits on available (comparably smaller) devices. |
|
Calls KaHyPar to partition a graph. |
|
Inserts a |
|
Automatically finds and places optimal |
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.