microsoft/qdk

Public

mirrored fromhttps://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
billti/num2-sim

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

samples/algorithms/MajoranaQubits/src/Main.qs

30lines · modecode

1/// # Sample
2/// Majorana Qubits
3///
4/// # Description
5/// In hardware providing majorana qubits, common quantum operations
6/// are implemented using measurements and Pauli corrections. This
7/// sample shows a hypothetical hardware provider exposing some custom
8/// gates to Q# and a small library built on top of it.
9
10/// Sample program using custom gates from a hardware provider.
11operation Main() : (Result, Result) {
12 // Create a Bell Pair in the |𝚽⁺⟩ state.
13 use qs = Qubit[2];
14 GateSet.BellPair(qs[0], qs[1]);
15
16 // Applying X to any of the qubits will result in the |𝚿⁺⟩ Bell state.
17 // X(qs[0]); // Uncomment to try
18
19 // Applying Z to any of the qubits will result in the |𝚽⁻⟩ Bell state.
20 // Z(qs[0]); // Uncomment to try
21
22 // Applying X and Z to the pair will result in the |𝚿⁻⟩ Bell state.
23 // Note that they can be applied to the same Qubit.
24 // Z(qs[0]); // Uncomment to try
25 // X(qs[0]);
26
27 let res = GateSet.BellMeasurement(qs[0], qs[1]);
28 ResetAll(qs);
29 res
30}
31