qiskit_addon_cutting.partition_circuit_qubits¶
- partition_circuit_qubits(circuit, partition_labels, inplace=False)[source]¶
Replace all nonlocal gates belonging to more than one partition with instances of
TwoQubitQPDGate
.TwoQubitQPDGate
s belonging to a single partition will not be affected.- Parameters:
circuit (
QuantumCircuit
) – The circuit to partitionpartition_labels (
Sequence
[Hashable
]) – A sequence containing a partition label for each qubit in the input circuit. Nonlocal gates belonging to more than one partition will be replaced withTwoQubitQPDGate
s.inplace (
bool
) – Flag denoting whether to copy the input circuit before acting on it
- Return type:
- Returns:
The output circuit with each nonlocal gate spanning two partitions replaced by a
TwoQubitQPDGate
- Raises:
ValueError – The length of partition_labels does not equal the number of qubits in the circuit.
ValueError – Input circuit contains unsupported gate.