#QuantumDevKit – #Qubit operations in Q#



I’m still at the Microsoft Tech Summit Toronto, so it’s time to share another interesting learned lesson from the Microsoft Quantum Development Kit.

In today’s post, I will talk about the possible operations that we can perform on a Qubit. Well, the post is short:

We can only perform test for identity on Qubits (equality).

That’s the only operation we can do with a Qubit in Q#. Not really, we can use and pass Qubits as parameters between operations (reference model), and if we want to modify the state of them we have to use Q# Qubits .

In example, if we want to measure the status of a Qubit, we can use the M() operation

let measure = M(qubit[0]);

If, we want to change the value of Zero to One, or vice versa in a Qubit, we can use the X() operation


If, we want to apply a Hadamard transformation to a Qubit, we need to use the H() operation, the syntax would be


Almost all operations can be found under the namespace [Microsoft Quantum. Primitive]. I strongly advise to spend some time reading and understanding how quantum mechanics works before you start working with this type of gates (Pauli Gates). Hey, but this is material for other post!

Happy QCoding!

Greetings @ Microsoft Tech Summit

El Bruno




Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: