Open 1ucian0 opened 3 years ago
I simplified the example even further:
from qiskit import *
circuit = QuantumCircuit(QuantumRegister(2, "qr"))
circuit.cx(0, 1)
transpiled=transpile(circuit, coupling_map=[[1, 0]],
basis_gates=['id', 'rz', 'sx', 'x', 'cx'], optimization_level=3,
initial_layout=range(2), seed_transpiler=42)
global phase: π
┌───┐ ┌───┐ »
qr_0 -> 0 ───┤ X ├─────────────────────────────────────────────■─────┤ X ├────»
┌──┴───┴──┐┌────┐┌──────────────┐┌────┐┌──────────┐┌─┴─┐┌──┴───┴───┐»
qr_1 -> 1 ┤ RZ(π/2) ├┤ √X ├┤ RZ(-0.76394) ├┤ √X ├┤ RZ(-π/2) ├┤ X ├┤ RZ(-π/2) ├»
└─────────┘└────┘└──────────────┘└────┘└──────────┘└───┘└──────────┘»
« ┌────────┐
«qr_0 -> 0 ┤ RZ(-π) ├────────────────────────────────
« └─┬────┬─┘┌─────────────┐┌────┐┌─────────┐
«qr_1 -> 1 ──┤ √X ├──┤ RZ(-2.3777) ├┤ √X ├┤ RZ(π/2) ├
« └────┘ └─────────────┘└────┘└─────────┘
Information
What is the current behavior?
Notice that the edge
[1, 3]
is not there. However, this is part of the output:The first cnot in this page is going in the
1, 3
direction.I suspect that the optimization loop is assuming a symmetric coupling map. If I move the
GateDirection
at the end of the pass manager, it works correctly.