Q# | |
Released: | [1] |
Developer: | Microsoft |
Designer: | Microsoft Research (quantum architectures and computation group; QuArC) |
Influenced By: | C#, F#, Python |
File Extensions: | .qs |
Platform: | Common Language Infrastructure |
Paradigm: | Quantum, functional, imperative |
Typing: | Static, strong |
License: | MIT License[2] |
Q# (pronounced Q sharp) is a domain-specific programming language used for expressing quantum algorithms.[3] It was initially released to the public by Microsoft as part of the Quantum Development Kit.[4]
Q# works in conjunction with classical languages such as C#, Python and F#, and is designed to allow the use of traditional programming concepts in quantum computing, including functions with variables and branches as well as a syntax-highlighted development environment with a quantum debugger.[5] [6]
Historically, Microsoft Research had two teams interested in quantum computing: the QuArC team based in Redmond, Washington,[7] directed by Krysta Svore, that explored the construction of quantum circuitry, and Station Q initially located in Santa Barbara and directed by Michael Freedman, that explored topological quantum computing.[8] [9]
During a Microsoft Ignite Keynote on September 26, 2017, Microsoft announced that they were going to release a new programming language geared specifically towards quantum computers.[10] On December 11, 2017, Microsoft released Q# as a part of the Quantum Development Kit.
At Build 2019, Microsoft announced that it would be open-sourcing the Quantum Development Kit, including its Q# compilers and simulators.[11]
To support Q#, Microsoft developed Quantum Intermediate Representation (QIR) in 2023 as a common interface between programming languages and target quantum processors. The company also announced a compiler extension that generates QIR from Q#.[12]
Bettina Heim currently leads the Q# language development effort.[13] [14]
Q# is available as a separately downloaded extension for Visual Studio,[15] but it can also be run as an independent tool from the command line or Visual Studio Code. Q# was introduced on Windows and is available on MacOS and Linux.[16]
The Quantum Development Kit includes a quantum simulator capable of running Q# and simulated 30 logical qubits.[17] [18]
In order to invoke the quantum simulator, another .NET programming language, usually C#, is used, which provides the (classical) input data for the simulator and reads the (classical) output data from the simulator.[19]
A primary feature of Q# is the ability to create and use qubits for algorithms. As a consequence, some of the most prominent features of Q# are the ability to entangle and introduce superpositioning to qubits via controlled NOT gates and Hadamard gates, respectively, as well as Toffoli Gates, Pauli X, Y, Z Gate, and many more which are used for a variety of operations; see the list at the article on quantum logic gates.[20]
The hardware stack that will eventually come together with Q# is expected to implement Qubits as topological qubits. The quantum simulator that is shipped with the Quantum Development Kit today is capable of processing up to 32 qubits on a user machine and up to 40 qubits on Azure.[21]
Currently, the resources available for Q# are scarce, but the official documentation is published: Microsoft Developer Network: Q#. Microsoft Quantum Github repository is also a large collection of sample programs implementing a variety of Quantum algorithms and their tests.
Microsoft has also hosted a Quantum Coding contest on Codeforces, called Microsoft Q# Coding Contest - Codeforces, and also provided related material to help answer the questions in the blog posts, plus the detailed solutions in the tutorials.
Microsoft hosts a set of learning exercises to help learn Q# on GitHub: microsoft/QuantumKatas with links to resources, and answers to the problems.
Q# is syntactically related to both C# and F# yet also has some significant differences.
=>
operator.The following source code is a multiplexer from the official Microsoft Q# library repository.
namespace Microsoft.Quantum.Canon