circuit_knitting.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.

If partition_labels is not provided, then it will be determined automatically from the connectivity of the circuit. This automatic determination ignores any TwoQubitQPDGates in the circuit, 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.

All cut instructions will be replaced with SingleQubitQPDGates.

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 – The input circuit should contain no classical bits or registers.