Sequential Quantum Gate Decomposer
v1.9.6
Powerful decomposition of general unitarias into one- and two-qubit gates gates
tmp38logioh
benchmarks
density_matrix
spec-quiskit.py
Go to the documentation of this file.
1
from
qiskit
import
QuantumCircuit
2
from
qiskit_aer
import
AerSimulator
3
from
qiskit_aer.noise
import
depolarizing_error
4
5
# 1. Create the circuit
6
qc = QuantumCircuit(2)
7
8
# --- FIRST INSTANCE (Noisy) ---
9
qc.h(0)
10
# Manually append the error instruction immediately after the gate
11
error_1q = depolarizing_error(0.2, 1)
12
qc.append(error_1q, [0])
# This effectively makes the previous H gate noisy
13
14
# --- SECOND INSTANCE (Ideal) ---
15
qc.h(0)
16
# We do NOT append an error here, so this H remains ideal
17
18
qc.measure_all()
19
20
# 2. Simulate
21
# Note: We do NOT need to pass a noise_model argument because
22
# the noise is already baked into the circuit instructions.
23
sim = AerSimulator()
24
result = sim.run(qc).
result
()
25
counts = result.get_counts()
26
27
print(
"Circuit with manually inserted noise:"
)
28
print(qc)
spec-quiskit.result
result
Definition:
spec-quiskit.py:24
Generated on Thu Jul 9 2026 07:59:24 for Sequential Quantum Gate Decomposer by
1.8.13