Quantum Teleportation Simulator - Q#

May 28, 2022
   41

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):


  1. az login
  2. az account set -s MySubscriptionID
  3. az quantum workspace set -g AzureQuantum -w WorkspaceName -l eastus -o table
  4.  az quantum execute --target-id quantinuum.hqs-lt-s2-sim -- --prep-basis PauliX --meas-basis PauliX