Gate Cutting to Reduce Circuit Width
หน้านี้ยังไม่ได้รับการแปล คุณกำลังดูเวอร์ชันต้นฉบับภาษาอังกฤษ
In this notebook, we will work through the steps of a Qiskit pattern while using circuit cutting to reduce the number of qubits in a circuit. We will cut gates to enable us to reconstruct the expectation value of a four-qubit circuit using only two-qubit experiments.
These are the steps that we will take:
- Step 1: Map problem to quantum circuits and operators:
- Map the hamiltonian onto a quantum circuit.
- Step 2: Optimize for target hardware [Uses the cutting addon]:
- Cut the circuit and observable.
- Transpile the subexperiments for hardware.
- Step 3: Execute on target hardware:
- Run the subexperiments obtained in Step 2 using a
Samplerprimitive.
- Run the subexperiments obtained in Step 2 using a
- Step 4: Post-process results [Uses the cutting addon]:
- Combine the results of Step 3 to reconstruct the expectation value of the observable in question.
Step 1: Map
Create a circuit to cut
# Added by doQumentation — required packages for this notebook
!pip install -q numpy qiskit qiskit-addon-cutting qiskit-aer qiskit-ibm-runtime
from qiskit.circuit.library import efficient_su2
qc = efficient_su2(4, entanglement="linear", reps=2)
qc.assign_parameters([0.4] * len(qc.parameters), inplace=True)
qc.draw("mpl", scale=0.8)

Specify an observable
from qiskit.quantum_info import SparsePauliOp
observable = SparsePauliOp(["ZZII", "IZZI", "-IIZZ", "XIXI", "ZIZZ", "IXIX"])
Step 2: Optimize
Separate the circuit and observable according to a specified qubit partitioning
Each label in partition_labels corresponds to the circuit qubit in the same index. Qubits sharing a common partition label will be grouped together, and non-local gates spanning more than one partition will be cut.
Note: The observables kwarg to partition_problem is of type PauliList. Observable term coefficients and phases are ignored during decomposition of the problem and execution of the subexperiments. They may be re-applied during reconstruction of the expectation value.
from qiskit_addon_cutting import partition_problem
partitioned_problem = partition_problem(
circuit=qc, partition_labels="AABB", observables=observable.paulis
)
subcircuits = partitioned_problem.subcircuits
subobservables = partitioned_problem.subobservables
bases = partitioned_problem.bases