10
$\begingroup$

The circuit

enter image description here

can be translated to the following code:

operation Teleport(msg, there) {
    let register = AllocateRegister();
    let here = register;
    H(here);
    CNOT(here, there);
    CNOT(msg, here);
    H(msg);
    // Measure out the entanglement.
    if (M(msg) == One)  { Z(there); }
    if (M(here) == One) { X(there); }
  }
}

How do the if-statements come about? Why are double-lines used after measurements?

$\endgroup$
  • $\begingroup$ May I ask what the language is in that example? Is it Q#? $\endgroup$ – Norrius Mar 31 '18 at 14:42
  • 2
    $\begingroup$ No, but it was based on Q#. I didn't want to demand Q#-familiarity from readers, so I created this pseudo-code that uses only features from widely used languages. $\endgroup$ – R. Chopin Mar 31 '18 at 14:46
13
$\begingroup$

The double lines are one common convention for classical bits in quantum circuit diagrams. In this case, they represent the bits arising from the measurements of the qubits msg and here.

The controlled operations involving the classical bits are just operations which are performed if those classical bits happen to have the value 1, which is what the if statements are for in the pseudocode.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.