Quantum programming is the process of
assembling sequences of instructions, called quantum circuits, that are capable of running on a
quantum computer
Quantum computing is a type of computation whose operations can harness the phenomena of quantum mechanics, such as superposition, interference, and entanglement. Devices that perform quantum computations are known as quantum computers. Though ...
. Quantum
programming language
A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language.
The description of a programming ...
s help express
quantum algorithm
In quantum computing, a quantum algorithm is an algorithm which runs on a realistic model of quantum computation, the most commonly used model being the quantum circuit model of computation. A classical (or non-quantum) algorithm is a finite sequ ...
s using high-level constructs. The field is deeply rooted in the
open-source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
philosophy and as a result most of the quantum software discussed in this article is freely available as
open-source software
Open-source software (OSS) is computer software that is released under a license in which the copyright holder grants users the rights to use, study, change, and distribute the software and its source code to anyone and for any purpose. Op ...
.
Quantum instruction sets
Quantum instruction sets are used to turn higher level algorithms into physical instructions that can be executed on quantum processors. Sometimes these instructions are specific to a given hardware platform, e.g.
ion traps or
superconducting qubits
Superconducting quantum computing is a branch of solid state quantum computing which implements superconducting electronic circuits using superconducting qubits as artificial atoms, or quantum dots. For superconducting qubits, the two logic states ...
.
cQASM
cQASM, also known as common QASM, is a hardware-agnostic quantum assembly language which guarantees the interoperability between all the quantum compilation and simulation tools. It was introduced by the QCA Lab at
TUDelft.
Quil
Quil is an instruction set architecture for quantum computing that first introduced a shared quantum/classical memory model. It was introduced by Robert Smith, Michael Curtis, and William Zeng in ''A Practical Quantum Instruction Set Architecture''. Many quantum algorithms (including
quantum teleportation,
quantum error correction
Quantum error correction (QEC) is used in quantum computing to protect quantum information from errors due to decoherence and other quantum noise. Quantum error correction is theorised as essential to achieve fault tolerant quantum computing that ...
, simulation, and optimization algorithms) require a shared memory architecture.
OpenQASM
OpenQASM
Open Quantum Assembly Language (OpenQASM; pronounced ''open kazm'') is a programming language designed for describing quantum circuits and algorithms for execution on quantum computers. It is designed to be an intermediate representation that can ...
is the intermediate representation introduced by IBM for use with
Qiskit
Qiskit is an open-source Software development kit, software development kit (SDK) for working with Quantum Computer, quantum computers at the level of circuits, pulses, and algorithms. It provides tools for creating and manipulating Quantum circu ...
and the
IBM Q Experience
The IBM Quantum Composer and the IBM Quantum Lab (previously known collectively as the IBM Quantum Experience) form an online platform allowing public and premium access to cloud-based quantum computing services provided by IBM Quantum. This includ ...
.
Blackbird
Blackbird is a quantum instruction set and intermediate representation used by
Xanadu Quantum Technologies and Strawberry Fields. It is designed to represent
continuous-variable quantum programs that can run on photonic quantum hardware.
Quantum software development kits
Quantum
software development kit
A software development kit (SDK) is a collection of software development tools in one installable package. They facilitate the creation of applications by having a compiler, debugger and sometimes a software framework. They are normally specific to ...
s provide collections of tools to create and manipulate quantum programs. They also provide the means to simulate the quantum programs or prepare them to be run using
cloud-based quantum devices and self-hosted quantum devices.
SDKs with access to quantum processors
The following
software development kit
A software development kit (SDK) is a collection of software development tools in one installable package. They facilitate the creation of applications by having a compiler, debugger and sometimes a software framework. They are normally specific to ...
s can be used to run quantum circuits on prototype quantum devices, as well as on simulators.
Ocean
An Open Source suite of tools developed by D-Wave. Written mostly in the Python programming language, it enables users to formulate problems in Ising Model and Quadratic Unconstrained Binary Optimization formats (QUBO). Results can be obtained by submitting to an online quantum computer in Leap, D-Wave's real-time Quantum Application Environment, customer-owned machines, or classical samplers.
ProjectQ
An
Open Source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
project developed at the Institute for Theoretical Physics at
ETH
(colloquially)
, former_name = eidgenössische polytechnische Schule
, image = ETHZ.JPG
, image_size =
, established =
, type = Public
, budget = CHF 1.896 billion (2021)
, rector = Günther Dissertori
, president = Joël Mesot
, ac ...
, which uses the
Python programming
Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation.
Python is dynamically-typed and garbage-collected. It supports multiple programming par ...
language to create and manipulate quantum circuits. Results are obtained either using a simulator, or by sending jobs to IBM quantum devices.
Qiskit
An
Open Source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
project developed by
IBM. Quantum circuits are created and manipulated using
Python
Python may refer to:
Snakes
* Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia
** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia
* Python (mythology), a mythical serpent
Computing
* Python (pro ...
. Results are obtained either using simulators that run on the user's own device, simulators provided by IBM or prototype quantum devices provided by IBM. As well as the ability to create programs using basic quantum operations, higher level tools for algorithms and benchmarking are available within specialized packages. Qiskit is based on the
OpenQASM
Open Quantum Assembly Language (OpenQASM; pronounced ''open kazm'') is a programming language designed for describing quantum circuits and algorithms for execution on quantum computers. It is designed to be an intermediate representation that can ...
standard for representing quantum circuits. It also supports pulse level control of quantum systems via QiskitPulse standard.
Qibo
An
Open Source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
full-stack API for quantum simulation, quantum hardware control and calibration developed by multiple research laboratories, including
QRC,
CQT and
INFNQibois a modular framework which includes multiple backends for quantum simulation and hardware control. This project aims at providing a platform agnostic quantum hardware control framework with drivers for multiple instruments and tools for quantum calibration, characterization and validation. This framework focuses on self-hosted quantum devices by simplifying the software development required in labs.
Forest
An
Open Source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
project developed by
Rigetti
Rigetti Computing is a Berkeley, California-based developer of quantum integrated circuits used for quantum computers. The company also develops a cloud platform called Forest that enables programmers to write quantum algorithms.
History
Rigetti ...
, which uses the
Python programming
Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation.
Python is dynamically-typed and garbage-collected. It supports multiple programming par ...
language to create and manipulate quantum circuits. Results are obtained either using simulators or prototype quantum devices provided by Rigetti. As well as the ability to create programs using basic quantum operations, higher level algorithms are available within the Grove package. Forest is based on the
Quil instruction set.
t, ket>
A quantum programming environment and optimizing compiler developed by
Cambridge Quantum Computing
Cambridge Quantum (CQ) is an independent quantum computing company, based in Cambridge, England. Founded in 2014, CQ builds tools for the commercialization of quantum technologies with a focus on quantum software and quantum cybersecurity. CQ has ...
that targets simulators and several quantum hardware back-ends, released in December 2018.
Strawberry Fields
An
open-source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
Python
Python may refer to:
Snakes
* Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia
** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia
* Python (mythology), a mythical serpent
Computing
* Python (pro ...
library developed by
Xanadu Quantum Technologies for designing, simulating, and optimizing
continuous variable
In mathematics and statistics, a quantitative variable may be continuous or discrete if they are typically obtained by ''measuring'' or ''counting'', respectively. If it can take on two particular real values such that it can also take on all re ...
(CV)
quantum optical circuits. Three simulators are provided - one in the
Fock basis, one using the Gaussian formulation of quantum optics, and one using the
TensorFlow machine learning library. Strawberry Fields is also the library for executing programs on Xanadu's quantum photonic hardware.
PennyLane
An
open-source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
Python
Python may refer to:
Snakes
* Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia
** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia
* Python (mythology), a mythical serpent
Computing
* Python (pro ...
library developed by
Xanadu Quantum Technologies for
differentiable programming of quantum computers. PennyLane provides users the ability to create models using
TensorFlow,
NumPy, or
PyTorch, and connect them with quantum computer backends available from
IBMQ,
Google Quantum,
Rigetti
Rigetti Computing is a Berkeley, California-based developer of quantum integrated circuits used for quantum computers. The company also develops a cloud platform called Forest that enables programmers to write quantum algorithms.
History
Rigetti ...
,
Quantinuum and
Alpine Quantum Technologies
Alpine may refer to any mountainous region. It may also refer to:
Places Europe
* Alps, a European mountain range
** Alpine states, which overlap with the European range
Australia
* Alpine, New South Wales, a Northern Village
* Alpine Nationa ...
.
Quantum Development Kit
A project developed by
Microsoft
Microsoft Corporation is an American multinational technology corporation producing computer software, consumer electronics, personal computers, and related services headquartered at the Microsoft Redmond campus located in Redmond, Washing ...
as part of the
.NET Framework
The .NET Framework (pronounced as "''dot net"'') is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until bein ...
. Quantum programs can be written and run within
Visual Studio
Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs including web site, websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platfor ...
and
VSCode using the quantum programming language Q#. Programs developed in the QDK can be run on Microsoft's
Azure Quantum, and run on quantum computers from
Quantinuum,
IonQ, and
Pasqal.
Cirq
An
Open Source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
project developed by
Google
Google LLC () is an American multinational technology company focusing on search engine technology, online advertising, cloud computing, computer software, quantum computing, e-commerce, artificial intelligence, and consumer electronics. ...
, which uses the
Python programming
Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation.
Python is dynamically-typed and garbage-collected. It supports multiple programming par ...
language to create and manipulate quantum circuits. Programs written in Cirq can be run on
IonQ,
Pasqal,
Rigetti
Rigetti Computing is a Berkeley, California-based developer of quantum integrated circuits used for quantum computers. The company also develops a cloud platform called Forest that enables programmers to write quantum algorithms.
History
Rigetti ...
, and
Alpine Quantum Technologies
Alpine may refer to any mountainous region. It may also refer to:
Places Europe
* Alps, a European mountain range
** Alpine states, which overlap with the European range
Australia
* Alpine, New South Wales, a Northern Village
* Alpine Nationa ...
.
Quantum programming languages
There are two main groups of quantum programming languages:
imperative quantum programming languages and
functional
Functional may refer to:
* Movements in architecture:
** Functionalism (architecture)
** Form follows function
* Functional group, combination of atoms within molecules
* Medical conditions without currently visible organic basis:
** Functional sy ...
quantum programming languages.
Imperative languages
The most prominent representatives of the imperative languages are QCL, LanQ and Q, SI>.
QCL
Quantum Computation Language
Quantum Computation Language (QCL) is one of the first implemented quantum programming languages. The most important feature of QCL is the support for user-defined operators and functions. Its syntax resembles the syntax of the C programming l ...
(QCL) is one of the first implemented quantum
programming languages. The most important feature of QCL is the support for user-defined operators and functions. Its
syntax
In linguistics, syntax () is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure ( constituency) ...
resembles the syntax of the
C programming language
''The C Programming Language'' (sometimes termed ''K&R'', after its authors' initials) is a computer programming book written by Brian Kernighan and Dennis Ritchie, the latter of whom originally designed and implemented the language, as well as ...
and its classical
data type
In computer science and computer programming, a data type (or simply type) is a set of possible values and a set of allowed operations on it. A data type tells the compiler or interpreter how the programmer intends to use the data. Most progra ...
s are similar to primitive data types in C. One can combine classical code and quantum code in the same program.
Quantum pseudocode
Quantum pseudocode proposed by E. Knill is the first formalized language for description of
quantum algorithm
In quantum computing, a quantum algorithm is an algorithm which runs on a realistic model of quantum computation, the most commonly used model being the quantum circuit model of computation. A classical (or non-quantum) algorithm is a finite sequ ...
s. It was introduced and, moreover, was tightly connected with a model of quantum machine called
Quantum Random Access Machine (QRAM).
Q#
A language developed by
Microsoft
Microsoft Corporation is an American multinational technology corporation producing computer software, consumer electronics, personal computers, and related services headquartered at the Microsoft Redmond campus located in Redmond, Washing ...
to be used with the
Quantum Development Kit.
Q, SI>
Q, SI> is a platform embedded in
.Net language supporting quantum programming in a quantum extension of while-language.
This platform includes a compiler of the quantum while-language and a chain of tools for the simulation of quantum computation, optimisation of quantum circuits, termination analysis of quantum programs, and verification of quantum programs.
Q language
Q Language is the second implemented imperative quantum programming language. Q Language was implemented as an extension of C++ programming language. It provides classes for basic quantum operations like QHadamard, QFourier, QNot, and QSwap, which are derived from the base class Qop. New operators can be defined using C++ class mechanism.
Quantum memory is represented by class Qreg.
Qreg x1; // 1-qubit quantum register with initial value 0
Qreg x2(2,0); // 2-qubit quantum register with initial value 0
The computation process is executed using a provided simulator. Noisy environments can be simulated using parameters of the simulator.
qGCL
Quantum Guarded Command Language (qGCL) was defined by P. Zuliani in his PhD thesis. It is based on
Guarded Command Language The Guarded Command Language (GCL) is a programming language defined by Edsger Dijkstra for predicate transformer semantics in EWD472. It combines programming concepts in a compact way. It makes it easier to develop a program and its proof hand-in-h ...
created by
Edsger Dijkstra.
It can be described as a language of quantum programs specification.
QMASM
Quantum Macro Assembler (QMASM) is a low-level language specific to quantum annealers such as the D-Wave.
Scaffold
Scaffold is C-like language, that compiles to QASM and OpenQASM. It is built on top of the
LLVM
LLVM is a set of compiler and toolchain technologies that can be used to develop a front end for any programming language and a back end for any instruction set architecture. LLVM is designed around a language-independent intermediate represen ...
Compiler Infrastructure to perform optimizations on Scaffold code before generating a specified instruction set.
Silq
Silq is a high-level programming language for quantum computing with a strong static type system, developed at
ETH Zürich
(colloquially)
, former_name = eidgenössische polytechnische Schule
, image = ETHZ.JPG
, image_size =
, established =
, type = Public
, budget = CHF 1.896 billion (2021)
, rector = Günther Dissertori
, president = Joël Mesot
, ac ...
.
Functional languages
Efforts are underway to develop
functional programming languages
In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions that m ...
for
quantum computing
Quantum computing is a type of computation whose operations can harness the phenomena of quantum mechanics, such as superposition, interference, and entanglement. Devices that perform quantum computations are known as quantum computers. Though ...
. Functional programming languages are well-suited for reasoning about programs. Examples include Selinger's QPL,
[Peter Selinger]
"Towards a quantum programming language"
Mathematical Structures in Computer Science 14(4):527-586, 2004. and the
Haskell-like language QML by Altenkirch and Grattage.
[Jonathan Grattage: QML Research](_blank)
(website)[T. Altenkirch, V. Belavkin, J. Grattage, A. Green, A. Sabry, J. K. Vizzotto]
QML: A Functional Quantum Programming Language
(website) Higher-order quantum programming languages, based on
lambda calculus
Lambda calculus (also written as ''λ''-calculus) is a formal system in mathematical logic for expressing computation based on function abstraction and application using variable binding and substitution. It is a universal model of computation ...
, have been proposed by van Tonder, Selinger and Valiron and by Arrighi and Dowek.
QFC and QPL
QFC and QPL are two closely related quantum programming languages defined by Peter Selinger. They differ only in their syntax: QFC uses a flow chart syntax, whereas QPL uses a textual syntax. These languages have classical control flow but can operate on quantum or classical data. Selinger gives a denotational semantics for these languages in a category of
superoperator
In physics, a superoperator is a linear operator acting on a vector space of linear operators.John Preskill, Lecture notes for Quantum Computation course at CaltechCh. 3
Sometimes the term refers more specially to a completely positive map which ...
s.
QML
QML is a
Haskell-like quantum programming language by Altenkirch and Grattage.
Unlike Selinger's QPL, this language takes duplication, rather than discarding, of quantum information as a primitive operation. Duplication in this context is understood to be the operation that maps
to
, and is not to be confused with the impossible operation of
cloning; the authors claim it is akin to how sharing is modeled in classical languages. QML also introduces both classical and quantum control operators, whereas most other languages rely on classical control.
An
operational semantics for QML is given in terms of
quantum circuits, while a
denotational semantics
In computer science, denotational semantics (initially known as mathematical semantics or Scott–Strachey semantics) is an approach of formalizing the meanings of programming languages by constructing mathematical objects (called ''denotations'' ...
is presented in terms of
superoperator
In physics, a superoperator is a linear operator acting on a vector space of linear operators.John Preskill, Lecture notes for Quantum Computation course at CaltechCh. 3
Sometimes the term refers more specially to a completely positive map which ...
s, and these are shown to agree. Both the operational and denotational semantics have been implemented (classically) in Haskell.
LIQUi, >
LIQUi, > (pronounced ''liquid'') is a quantum simulation extension on the
F# programming language. It is currently being developed by the Quantum Architectures and Computation Group (QuArC) part of the StationQ efforts at Microsoft Research. LIQUi, > seeks to allow theorists to experiment with quantum algorithm design before physical quantum computers are available for use.
It includes a programming language, optimization and scheduling algorithms, and quantum simulators. LIQUi, > can be used to translate a quantum algorithm written in the form of a high-level program into the low-level machine instructions for a quantum device.
Quantum lambda calculi
Quantum lambda calculi are extensions of the classical
lambda calculus
Lambda calculus (also written as ''λ''-calculus) is a formal system in mathematical logic for expressing computation based on function abstraction and application using variable binding and substitution. It is a universal model of computation ...
introduced by
Alonzo Church and
Stephen Cole Kleene in the 1930s. The purpose of quantum lambda calculi is to extend quantum programming languages with a theory of
higher-order functions.
The first attempt to define a quantum lambda calculus was made by Philip Maymin in 1996.
His lambda-q calculus is powerful enough to express any quantum computation. However, this language can efficiently solve
NP-complete problems, and therefore appears to be strictly stronger than the standard quantum computational models (such as the
quantum Turing machine
A quantum Turing machine (QTM) or universal quantum computer is an abstract machine used to model the effects of a quantum computer. It provides a simple model that captures all of the power of quantum computation—that is, any quantum algori ...
or the
quantum circuit model). Therefore, Maymin's lambda-q calculus is probably not implementable on a physical device .
In 2003, André van Tonder defined an extension of the
lambda calculus
Lambda calculus (also written as ''λ''-calculus) is a formal system in mathematical logic for expressing computation based on function abstraction and application using variable binding and substitution. It is a universal model of computation ...
suitable for proving correctness of quantum programs. He also provided an implementation in the
Scheme A scheme is a systematic plan for the implementation of a certain idea.
Scheme or schemer may refer to:
Arts and entertainment
* ''The Scheme'' (TV series), a BBC Scotland documentary series
* The Scheme (band), an English pop band
* ''The Schem ...
programming language.
In 2004, Selinger and Valiron defined a
strongly typed
In computer programming, one of the many ways that programming languages are colloquially classified is whether the language's type system makes it strongly typed or weakly typed (loosely typed). However, there is no precise technical definition o ...
lambda calculus for quantum computation with a type system based on
linear logic
Linear logic is a substructural logic proposed by Jean-Yves Girard as a refinement of classical and intuitionistic logic, joining the dualities of the former with many of the constructive properties of the latter. Although the logic has also be ...
.
Quipper
Quipper was published in 2013. It is implemented as an embedded language, using
Haskell as the host language. For this reason, quantum programs written in Quipper are written in
Haskell using provided libraries. For example, the following code implements preparation of a superposition
import Quipper
spos :: Bool -> Circ Qubit
spos b = do q <- qinit b
r <- hadamard q
return r
funQ
A group of undergraduate students at Chalmers University of Technology developed a functional quantum programming language in 2021. It is inspired by the quantum typed lambda calculus by Selinger and Valiron.
[Nicklas Botö, Fabian Forslund, Matilda Blomqvist, Beata Burreau, Marcus Jörgensson, Joel Rudsber]
"funQ - Functional Quantum Programming"
/ref> The underlying quantum simulator is a part of a Haskell library by the same name. The following code implements superposition in funQ
spos : !(Bit -o QBit)
spos b = H (new b)
The same example in the Haskell library would be
import FunQ
spos :: Bit -> QM QBit
spos b = hadamard =<< new b
References
Further reading
*
External links
Curated list
of all quantum open-source software projects
Bibliography on Quantum Programming Languages
(updated in May 2007)
4th International Workshop on Quantum Programming Languages
3rd International Workshop on Quantum Programming Languages
2nd International Workshop on Quantum Programming Languages
Quantum programming language
i
Quantiki
QMASM documentation
includin
Scaffold Source
{{emerging technologies, quantum=yes, other=yes
Programming language classification
Programming paradigms
Quantum computing