What is Quantum Programming? Get started now in 10 minutes and become Great at Quantum Computing and Quantum Programming

Getting Started With Quantum Programming

You may have heard of standard or classical programming. Programming is the task of creating the software, tools, and devices that we all use daily. Software is everywhere, whether using a browser or driving a car, and making this software is done with programming. Marc Andreessen states software is eating the world, but what about quantum programming? We briefly look at quantum software development and ask what quantum programming is.

Classical Programming Languages

Programming languages bridge human logic and machine operations, enabling us to instruct computers to perform specific tasks. At their core, they are a set of syntactical and semantic rules that define how programs written in that language should be constructed and executed.

When a programmer writes code in a high-level programming language like Python or Java, the computer’s hardware does not directly understand this code. Instead, it must be translated into machine code, a low-level representation of the program the computer’s processor can execute. Compilers or interpreters do this translation. Compilers translate the entire program into machine code before execution, while interpreters translate and run the program line-by-line at runtime.

Why Software is Eating the World

Marc Andreessen

The resulting machine code is a series of binary instructions that the computer’s hardware can execute directly. These instructions manipulate the computer’s memory, perform arithmetic operations, control program flow, and interact with input/output devices, ultimately allowing the computer to carry out the tasks defined by the programmer.

Python is a high-level, interpreted programming language known for its simplicity and readability. Guido van Rossum introduced it in the late 1980s, and its design philosophy emphasizes code readability, allowing developers to express concepts in fewer lines of code than possible in other languages. Python is versatile and used in various domains, from web development to data analysis and artificial intelligence.

Its extensive standard library and the availability of numerous third-party packages make it a favourite among many developers. Scientifically, Python has been adopted in fields like bioinformatics and astrophysics due to libraries like BioPython and Astropy. Python is so popular it is often used to control the libraries or frameworks that work with Quantum Circuits – more on that later!

Java is an object-oriented, high-level programming language developed by Sun Microsystems in the 1990s, now owned by Oracle Corporation. One of its defining characteristics is the “write once, run anywhere” principle. Java code, once compiled, produces bytecode, which can be executed on any device with a Java Virtual Machine (JVM), ensuring platform independence. Java is widely used in enterprise applications, web applications, and Android app development. Java is employed in large-scale simulation, modelling, and developing scientific software tools in the scientific community.

C++ is an extension of the C programming language, introduced in the early 1980s by Bjarne Stroustrup. It incorporates both procedural and object-oriented programming paradigms. Known for its performance and memory control capabilities, C++ is commonly used in system/software development and game development. It has also found its place in scientific computing, especially in critical performance scenarios. For instance, high-energy physics experiments like CERN use C++ for data analysis.

JavaScript is primarily known as a scripting language for web development, enabling interactive web pages. Netscape introduced it in the mid-1990s. Unlike the previously mentioned languages, JavaScript is mainly executed in the browser, making it essential for front-end web development. With the advent of Node.js, JavaScript can also be used on the server side. While its primary domain remains web development, scientific libraries like Plotly.js have emerged, directly allowing for data visualization and analysis in the browser.

While all these languages serve the purpose of programming, their design philosophies, application domains, and execution environments differ significantly. Python is celebrated for its simplicity, Java for its platform independence, C++ for its performance, and JavaScript for its web-centric capabilities. Each has found its niche in the scientific realm, catering to the community’s specific needs or the task.

What Is Quantum Programming? Get Started Now In 10 Minutes And Become Great At Quantum Computing
What is Quantum Programming? Get started now in 10 minutes and become Great at Quantum Computing

Quantum Programming Languages

Just in the classical cases – like the software used to write the browser you are reading this article on, the software is programmed in various languages. Some of which you are bound to have heard of from Assembler (acting at a low level) right the way through to Python and with languages like C/C++ in there too. Just as there are classical languages, there are quantum languages. Not languages that are just named this, but languages used for building quantum circuits.

Just as classical languages control the hardware of the machine at the fundamental level, including the memory, registers and other operations, quantum languages are designed to do exactly that but for quantum devices. In the quantum world, programming a quantum computer typically means building the gates and circuits the quantum computer uses to do its work and compute an algorithm or task. As in the classical case, quantum programming allows the programmer to control the hardware comprising qubits and quantum gates.

Quantum programmers can use the advantages of the language to perform some operations without needing to care what happens right at the low level or hardware of the machine. In much the same way a classical programmer doesn’t need to (often) worry about how bits are changed, quantum languages can abstract away some of that lower-level complexity and instead allow users to focus on levels above.

Quantum Languages vs Quantum Frameworks

Many confuse the difference between a quantum language and a quantum framework. They are not the same. A framework allows a user to control quantum hardware in various languages. It will then convert from a high-level interpretation into a low-level hardware version. There are actual quantum languages such as QASM, a low-level way of controlling qubits and performing operations on these qubits.

Q# is a standalone specific language for quantum computing developed by Microsoft and is now open source; it differs in that it is designed entirely for quantum computing and counts as language itself. In contrast to Qiskit, IBM has created a “framework”, meaning that an existing language such as Python can interact with a library framework, which then controls the quantum hardware and circuits.

A quantum programming language is a high-level language specifically designed to describe quantum algorithms and operations. In contrast, a quantum framework is a software library or toolkit that provides functionalities for quantum programming, often built on top of classical programming languages. While quantum languages focus on the syntax and semantics of quantum operations, frameworks provide tools, interfaces, and infrastructure to implement and run quantum programs on both simulators and actual quantum hardware.

Quantum Languages and Frameworks

Qiskit (Framework)

Developed by IBM, Qiskit is an open-source quantum computing framework that allows users to work with quantum circuits and run experiments on IBM’s quantum processors. Interfacing with Python, Qiskit provides a rich set of tools for quantum research, algorithm development, and even quantum education. One of its main strengths is its modularity, allowing users to choose specific components for their needs, whether it’s quantum machine learning, optimization, or cryptography.

Qiskit’s architecture is divided into several elements, including Terra (for quantum circuit design), Aer (for quantum simulation), Aqua (for quantum algorithms), and Ignis (for quantum error correction). This modular approach ensures that researchers and developers can focus on specific aspects of quantum computing without being overwhelmed by the entirety of the toolkit.

A distinguishing feature of Qiskit is its active community. IBM frequently hosts Qiskit challenges and hackathons, fostering a collaborative environment. The community contributes to the framework’s growth, ensuring it remains at the forefront of quantum software development. We ranked Qiskit as the most popular framework.

QuTiP (Framework)

The Quantum Toolbox in Python (QuTiP) is another open-source framework, but it’s primarily geared towards simulating quantum systems. While it’s not exclusively for quantum computing, it’s widely used for studying quantum mechanics and quantum information theory problems. QuTiP provides utilities to represent and manipulate quantum objects like states, operators, and Hamiltonians, making it a versatile tool for quantum research.

Unlike Qiskit, which is more oriented towards quantum computing tasks, QuTiP focuses on quantum dynamics simulations. It offers solvers for various problems, including time-dependent Schrödinger and master equations, making it invaluable for researchers in quantum optics, quantum information, and other fields.

QuTiP’s integration with Python’s scientific libraries, such as SciPy and Matplotlib, is a significant advantage. This seamless integration allows researchers to leverage the vast ecosystem of Python’s scientific computing tools alongside QuTiP’s quantum capabilities, bridging the gap between classical and quantum research.

Q# (Language)

Q# (pronounced “Q-sharp”) is a domain-specific programming language developed by Microsoft for quantum computing. Unlike the previously mentioned frameworks, Q# is a standalone language with syntax and semantics tailored for quantum algorithms and operations. It’s designed to be used alongside classical languages, particularly C#, to facilitate quantum-classical hybrid algorithms.

One of Q#’s standout features is its focus on abstracting away the intricacies of quantum hardware. Developers can write quantum algorithms without delving deep into the specifics of quantum gate operations or hardware constraints. This abstraction promotes a higher-level understanding of quantum algorithms, making the language more accessible to newcomers.

Furthermore, Q# integrates seamlessly with the Microsoft Quantum Development Kit (QDK), which provides tools, libraries, and simulators to aid quantum development. The QDK’s simulator allows developers to test their Q# programs on classical computers, offering insights into their behaviour before deploying them on quantum hardware.

QASM and OpenQASM (Languages)

QASM (Quantum Assembly Language) is an assembly-like language for specifying quantum circuits. It provides a low-level representation of quantum operations, allowing for precise control over quantum gates and their sequencing. OpenQASM, developed by IBM for their Qiskit framework, is an evolution of QASM. It extends the original language with more features, making it easier to describe complex quantum circuits. One of the main differences between QASM and OpenQASM is the latter’s support for parameterized gate definitions, which allows for more flexibility in specifying quantum operations.

Quil and Forest

Quil is a quantum instruction language developed by Rigetti Computing. It is designed to be a scalable, expressive, and hardware-agnostic language for quantum computing. Quil introduces classical control structures, allowing for hybrid quantum-classical programs.

Forest is Rigetti’s quantum programming environment that uses Quil as its primary language. One of the distinguishing features of Quil is its support for shared classical and quantum memory spaces, enabling seamless interaction between classical and quantum computations.

Cirq (Framework)

Cirq is a Python framework developed by Google for designing, simulating, and running quantum circuits on quantum processors and simulators. While Cirq is not a language, it provides a rich Python-based abstraction for defining and manipulating quantum circuits. One of the standout features of Cirq is its focus on near-term quantum computers, providing tools and methodologies that cater to the nuances and limitations of current quantum hardware.

t|ket> (Framework)

t|ket> (pronounced “ticket”) is a quantum software development kit by Cambridge Quantum Computing, now Quantinuum (part of Honeywell). It acts as a compiler, optimizing and translating high-level quantum algorithms into machine-ready instructions for various quantum hardware platforms.

ProjectQ (Framework)

ProjectQ is an open-source quantum computing framework that allows developers to implement their quantum programs in Python. It provides a high-level quantum circuit design, optimization, and simulation interface. One of its primary goals is to be hardware-agnostic, meaning it can run on various quantum backends, including real quantum chips and simulators.

ProjectQ has a powerful compiler that can translate high-level quantum algorithms into low-level machine instructions suitable for a quantum processor. It also offers a set of predefined quantum gates and operations, making it easier for developers to construct quantum circuits. Additionally, ProjectQ supports automatic resource management, ensuring efficient use of qubits and optimizing quantum circuits for better performance.

Ocean (framework)

Ocean is a software suite developed by D-Wave Systems, explicitly designed for programming D-Wave quantum annealers. Unlike universal quantum computers, quantum annealers are specialized machines that solve optimization problems. Ocean provides tools to formulate these problems and run them on D-Wave hardware.

Ocean’s primary component is its problem-solving toolkit, which helps formulate optimization problems as Ising or QUBO (Quadratic Unconstrained Binary Optimization) models. Once developed, these problems can be solved on D-Wave’s quantum annealers. Ocean also includes samplers and embedding techniques to map problems onto the D-Wave hardware.

Getting Started with Quantum Programming

Learning quantum computing does not need to be complicated. The best advice is to start. Numerous resources can help you learn quantum programming. There are multiple languages and frameworks, just like classical programming. Suppose you are beginning your quantum programming journey. In that case, safety in numbers most likely applies, and that means learning one of the more popular languages or frameworks, such as Qiskit, Q#, or Cirq.

Try one of the courses on Quantum Computing for an Introduction to Quantum Computing and Quantum Programming.

What Is Quantum Programming? Get Started Now
What is Quantum Programming? Get started now in 10 minutes and become Great at Quantum Computing and Quantum Programming