Quantum Teleportation Simulator - Q#
An attempt at Quantum Teleportation on Azure's Quantum Servers:
namespace QuantumTeleportation {
open Microsoft.Quantum.Arrays;
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Measurement;
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Preparation;
operation PrepareBellPair(left : Qubit, right : Qubit) : Unit is Adj + Ctl {
H(left);
CNOT(left, right);
}
@EntryPoint()
operation Teleport(prepBasis : Pauli, measBasis : Pauli) : Result {
use msg = Qubit();
use here = Qubit();
use there = Qubit();
PreparePauliEigenstate(prepBasis, msg);
PrepareBellPair(here, there);
Adjoint PrepareBellPair(msg, here);
if (MResetZ(msg) == One) { Z(there); }
if (MResetZ(here) == One) { X(there); }
let result = Measure([measBasis], [there]);
Reset(there);
return result;
}
}Output:
Reproducible Steps (Powershell-Windows):
- az login
- az account set -s MySubscriptionID
- az quantum workspace set -g AzureQuantum -w WorkspaceName -l eastus -o table
- az quantum execute --target-id quantinuum.hqs-lt-s2-sim -- --prep-basis PauliX --meas-basis PauliX