Closed ARO-GZ closed 2 years ago
Yep, it looks like something is going wrong with the classical registers. If you print the generated circuits they seem to be involved in the bell conditionals when they shouldn't be.
Original circuit:
┌───┐ ┌───┐┌─┐
q0_0: ┤ H ├──■─────────■──┤ H ├┤M├──────────
├───┤ │ ┌─┴─┐└┬─┬┘└╥┘
q0_1: ┤ H ├──┼────■──┤ X ├─┤M├──╫───────────
└───┘ │ ┌─┴─┐└───┘ └╥┘ ║ ┌───┐┌───┐
q0_2: ───────┼──┤ X ├───────╫───╫─┤ Z ├┤ X ├
┌─┴─┐└───┘ ║ ║ └─╥─┘└─╥─┘
q0_3: ─────┤ X ├────────────╫───╫───╫────╫──
└───┘ ║ ║ ║ ║
c0: ══════════════════════╬═══╩═══■════╬══
║ 0x1 ║
c1: ══════════════════════╩════════════■══
0x1
State tomography circuit
┌───┐ ┌───┐┌─┐
q_0: ┤ H ├──■─────────■──┤ H ├┤M├────────────────────────────────────
├───┤ │ ┌─┴─┐└┬─┬┘└╥┘
q_1: ┤ H ├──┼────■──┤ X ├─┤M├──╫─────────────────────────────────────
└───┘ │ ┌─┴─┐└───┘ └╥┘ ║ ┌───┐┌───┐ ░ ┌────────────┐ ░ ┌─┐
q_2: ───────┼──┤ X ├───────╫───╫─┤ Z ├┤ X ├─░─┤ PauliMeasZ ├─░─┤M├───
┌─┴─┐└───┘ ║ ║ └─╥─┘└─╥─┘ ░ ├────────────┤ ░ └╥┘┌─┐
q_3: ─────┤ X ├────────────╫───╫───╫────╫───░─┤ PauliMeasZ ├─░──╫─┤M├
└───┘ ║ ║ ║ ║ ░ └────────────┘ ░ ║ └╥┘
c_0: ══════════════════════╬═══╩═══■════o═══════════════════════╬══╬═
║ ║ ║ ║ ║
c_1: ══════════════════════╩═══════o════■═══════════════════════╬══╬═
║ ║ ║ ║
c_2: ══════════════════════════════o════o═══════════════════════╩══╬═
║ ║ ║
c_3: ══════════════════════════════o════o══════════════════════════╩═
Since these measurement circuits are constructed by using QuantumCircuit.compose
I expect this might be due to a bug in how that function handles flattening classical registers during composition.
Informations
What is the current behavior?
teleport_bell_state
(see code below) creates a bell state between qubits 0 and 3 and then teleports qubit 0 to qubit 2 through qubit 1. The state of qubits 2 and 3 at the end should then be the bell state initially shared between 0 and 1. However if we perform tomography on those qubits (2 and 3) then state one getsI also checked that it doesn't work if you try to teleport a single qubit in a computational state and reconstruct the state with tomography.
However it does work (both two cases) if one uses the principle of deferred measurements to replace the classically conditional operations used in teleportation (
teleport_bell_state_deferred
).Steps to reproduce the problem
What is the expected behavior?
One should be able to reconstruct the correct density matrix.
Suggested solutions
It seems that there is a problem with the way the tomography experiment handles the classical registers in the case in which classically conditioned operations are used.