Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Microsoft Open-Sources Q#, its Language for Quantum Computing

Microsoft Open-Sources Q#, its Language for Quantum Computing

This item in japanese


At its Build 2019 conference, Microsoft has announced it will open-source parts of its Quantum Developer Kit, including the Q# compiler and quantum simulators, this summer on GitHub.

Microsoft announced its Quantum Developer Kit and made it available to developers at the end of 2017, along with its plans to build a quantum computer of its own.

In contrast to other companies that have joined the quantum race, including Google, IBM, and others, Microsoft chose to create a new programming language, called Q# in assonance with C# and F#, to describe quantum computations.

Our high-level programming language, Q#, was designed to address the challenges of quantum information processing; it is integrated in a software stack that enables a quantum algorithm to be compiled down to the primitive operations of a quantum computer.

Q# is a domain-specific language with a native type system that, in addition to "classical" primitive types, also includes a direct representation of quantum abstractions, such as qubits, quantum operations and operators, and so on. Similarly, its flow-control instructions, besides for and repeat loops, return statements, etc., also comprise a few statements that can only be used within quantum operations. Those include using, which lets acquire a qubit, and borrowing, which grants temporary access to a qubit.

The following is an example of a Q# program that is able to set a qubit in a given state by looking at it and, if it is not in the required state, flipping it:

namespace Quantum.Bell {
    open Microsoft.Quantum.Primitive;

    operation Set (desired: Result, q1: Qubit) : () {
        body {
            let current = M(q1);
            if (desired != current) {

Microsoft Quantum Simulator is able to simulate up to 30 logical qubits using 16GB of memory. Microsoft claims that programs written for the simulator will run unmodified on their quantum computer, when available.

On the hardware front, Microsoft is pursuing a topological quantum processor using topological qubits. Topological qubits store information globally, within its topological structure, like it happens with a string, which you can say whether it is knotted or not only by looking at the whole picture and not to any of its local properties.

According to Microsoft, the open sourcing of their Quantum Developer Kit will mostly benefit programmers who want to contribute to the evolution of this evolving field, and all those institutions that require the use of open-source software and will be in a condition to use Q# for their research.

Rate this Article