qiskit_addon_cutting.partition_problem¶
- partition_problem(circuit, partition_labels=None, observables=None)[source]¶
Separate an input circuit and observable(s).
If
partition_labels
is provided, then qubits with matching partition labels will be grouped together, and non-local gates spanning more than one partition will be cut apart. The labelNone
is treated specially: any qubit with that partition label must be unused in the circuit.If
partition_labels
is not provided, then it will be determined automatically from the connectivity of the circuit. This automatic determination ignores anyTwoQubitQPDGate
s in thecircuit
, as these denote instructions that are explicitly destined for cutting. The resulting partition labels, in the automatic case, will be consecutive integers starting with 0. Qubits which are idle throughout the circuit will be assigned a partition label ofNone
.All cut instructions will be replaced with
SingleQubitQPDGate
s.If provided,
observables
will be separated along the boundaries specified by the partition labels.- Parameters:
circuit (QuantumCircuit) – The circuit to partition and separate
partition_labels (Sequence[Hashable] | None) – A sequence of labels, such that each label corresponds to the circuit qubit with the same index
observables (PauliList | None) – The observables to separate
- Return type:
PartitionedCuttingProblem
- Returns:
A tuple containing a dictionary mapping a partition label to a subcircuit, a list of QPD bases (one for each circuit gate or wire which was decomposed), and, optionally, a dictionary mapping a partition label to a list of Pauli observables.
- Raises:
ValueError – The number of partition labels does not equal the number of qubits in the circuit.
ValueError – An input observable acts on a different number of qubits than the input circuit.
ValueError – An input observable has a phase not equal to 1.
ValueError – A qubit with a label of
None
is not idleValueError – The input circuit should contain no classical bits or registers.