Based on the answers at here and here, I have a quantum simulator which implements the operations described in the classic Teleporting an Unknown Quantum State. Careful comparison of circuits with the IBM qiskit platform indicates that my simulator correctly implements gates, circuits and n-qubit measurement outcomes.
I am able to do this but unable to apply gates at the end to reconstruct the teleported qubit.
The teleportation circuit is quite simple; it first places qubits two and three in the Bell state $\Psi^-$ and then measures qubits 1 and 2 in the Bell basis. I extract the 3-qubit counts, using code that agrees with IBM's Q experience, and it appears based on the measurement counts that the final state from my simulator is correct.
The paper gives the final state as a function of the measurement outcomes. For example, it says if the initial sate is |0> and the measurement outcome is 00, then the final state of qubit 3 should be |1>, etc. When I look at my counts, it appears that the circuit is working correctly. THe measurement outcomes for input qubit |0> are
010
011
100
101
which looks correct.
However, the paper, and it's equation (5), imply that to reconstruct the teleported state, you apply the following gates to the third qubit:
$00\rightarrow Y$
$01\rightarrow Z$
$10\rightarrow X$
$11\rightarrow none$
I tried this, using the kronecker product to apply the gate to the third qubit, as described in the answer here. However, this give the wrong final states. I suspect that the reason is that I have to first reduce the 3-qubit state after measurement to a one-qubit state and apply the gate to that.
Running the corresponding circuit on IBM's quantum platform, I just measure the first two qubits and the counts look good.
I don't know how to simulate the state change that takes place during measurement. On my simulator, I don't simulate the measurement, so all three qubits remain entangled.
I doubt if this last step is correct - applying the gate to the three-qubit state - and even if it were, I don't know how to reduce the state to a single qubit.