The pseudo code for scenarios such as helloworld
, state testing, superposition and entanglement is presented in the sections below.
The pseudo code for helloworld is shown below:
- Quantum Simulator is instantiated
- The simulator calls the
helloworld
method - The method prints the message
- The message will print
Q#-HelloWorld
The pseudo code for state testing is shown below:
- Create a Qubit
- loop the logic below for number of times equal to count:
- initialize number of ones to zero
- call the set method with the initial and qubit parameters
- perform X gate on Qubit
- the result is set to measure of the qubit
- statistics are gathered for how many zeros and ones.
- collect the number of ones
- call the set method with zero and qubit parameters
- return the number of times zero and 1 is appeared.