M

This measures a single qubit in the Pauli-Z basis such that the output result is given by the distribution. The M operation is defined as:

Pr(Zero||ψ

)=

ψ|0
⟩⟨
0|ψ

How does the Q# language differ from C#? Here are a few points.

The using statement is different from that of C#. It's used to allocate an array of qubits for processing. Like the using statement in C#, the qubits are released at the end of the using statement. There are no qubits that are used for the entire lifetime of the application.

Q# has a different for loop that is used to iterate through a range. There is no direct equivalent of a C# for loop.

Q#, by default, has all variables as immutable, meaning that once they are assigned, they cannot be changed. There is a let keyword that will allow binding of the variable. Operational arguments are always immutable regardless. That being said, there is (at the time of writing) the ability to declare a variable with the mutable keyword and set the value later using the set statement.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.182.66