将两个量子位合成为 ["cx", "rz", "sx", "x"] 会返回一个错误的电路 (1 - F_avg ≈ 0.07), 靠近两个 CX 的边界
Qiskit bug report -- text for each field of the GitHub form
Open https://GitHub.com/Qiskit/qiskit/issues/new/choose and choose Bug report. Copy each block below into the field with the same name.
Title
Two-qubit synthesis to ["cx", "rz", "sx", "x"] returns a wrong circuit (1 - F_avg ≈ 0.07) near the two-CX boundary
Environment
- Qiskit version: 2.5.2 (latest release on PyPI at the time of writing; reproduced in a fresh virtual environment with numpy 2.5.3, scipy 1.18.1, rustworkx 0.18.1)
- Python version: 3.12.13
- Operating system: Linux (WSL2, glibc 2.43)
What is happening?
For the canonical two-qubit gate exp(i(0.6 XX + 0.3 YY + c ZZ)) with c = 3e-8, 1e-7 and 3e-7, TwoQubitBasisDecomposer(CXGate(), euler_basis="ZSX") returns a circuit whose unitary differs from the input with average gate infidelity 6.99e-2. The circuit has 3 CX gates, so the error is not visible from the gate counts.
The same failure appears in plain transpile() of a UnitaryGate to basis_gates=["cx", "rz", "sx", "x"], at every optimization level (0-3): 3 CX at levels 0-1 and 2 CX at levels 2-3, with the same infidelity. It also appears when the core is dressed with fixed single-qubit layers on both sides.
Not affected in our tests:
- the same decomposer with its default Euler basis (
TwoQubitBasisDecomposer(CXGate())): exact on the same inputs; - a CZ basis (
["cz", "rz", "sx", "x"]), levels 1 and 3; - a two-qubit
GenericBackendV2target with error data, levels 1 and 3; - the same gate given as
RXX/RYY/RZZinstead of aUnitaryGate.
Results are exact at c = 1e-8 (2 CX, within the documented approximation) and from c = 5e-7 upward.
How can we reproduce the issue?
from qiskit import QuantumCircuit, transpile
from qiskit.circuit.library import CXGate, UnitaryGate
from qiskit.quantum_info import Operator, average_gate_fidelity
from qiskit.synthesis import TwoQubitBasisDecomposer
core = QuantumCircuit(2)
core.rxx(-1.2, 0, 1) # a = 0.6
core.ryy(-0.6, 0, 1) # b = 0.3
core.rzz(-2e-7, 0, 1) # c = 1e-7
u = Operator(core)
out = TwoQubitBasisDecomposer(CXGate(), euler_basis="ZSX")(u.data)
print("decomposer ZSX:", 1 - average_gate_fidelity(Operator(out), u)) # ~6.99e-02
out_default = TwoQubitBasisDecomposer(CXGate(), euler_basis="ZSX")(u.data)
print("decomposer ZSX (default):", 1 - average_gate_fidelity(Operator(out), u)) # ~6.99e-02
out_cz = TwoQubitBasisDecomposer(CZGate(), euler_basis="ZSX")(u.data)
print("decomposer ZSX (CZ):", 1 - average_gate_fidelity(Operator(out), u)) # ~6.99e-02
out_core = TwoQubitBasisDecomposer(GenericBackendV2(), euler_basis="ZSX")(u.data)
print("decomposer ZSX (core):", 1 - average_gate_fidelity(Operator(out), u)) # ~6.99e-02
out_rxx = TwoQubitBasisDecomposer(RXXGate(), euler_basis="ZSX")(u.data)
print("decomposer ZSX (RXX):", 1 - average_gate_fidelity(Operator(out), u)) # ~6.99e-02
out_ryy = TwoQubitBasisDecomposer(RYYGate(), euler_basis="ZSX")(u.data)
print("decomposer ZSX (RYY):", 1 - average_gate_fidelity(Operator(out), u)) # ~6.99e-02
out_rzz = TwoQubitBasisDecomposer(RZZGate(), euler_basis="ZSX")(u.data)
print("decomposer ZSX (RZZ):", 1 - average_gate_fidelity(Operator(out), u)) # ~6.99e-02
内容来源: Qiskit/qiskit