Articles on Quantum Computing Quantum Machine Learning Quantum Platforms

Which Quantum Programming Language should you learn?

July 12, 2020

Just like classical programming languages such as C++, Python, JavaScript or even the ancient but still useful FORTRAN there are reasons to select one language over another. For example FORTRAN can still run pretty fast but lacks the ease of use and the libraries of Python which can be slower. But what about in the Quantum space, what language is appropriate? Here we’ll highlight languages that are suitable for almost anyone to get into Quantum programming.

Open QASM

Open Quantum Assembly Language (Open QASM) is rather like the classical assembly language in that instructions can be pieced together to perform operations on registers and in the quantum world, qubits. For example in this language you work on the manipulation of qubits and logical bits, perform measurements and collect those measurements.

The language originates from IBM and their IBM Q projects but it is open source and quite universal in its low level approach to manipulation of qubits.

Q#

Microsoft’s language is named after their “#” (sharp) family names of software such as C# and F# and Q# is their growing in popularity quantum language. As you’d expect from some of the leaders in programming languages Q# borrows features from more established programming languages such as C#. For example you’ll see familiar concepts such as namespace. Some benefits of the language is the obvious support from Microsoft even though the language is open sourced.

Perhaps not the most popular language yet as Microsoft was not the first on the scene with a quantum computing cloud framework but it does have its followers and the language integrates nicely with Microsoft tooling as you would expect.

The Microsoft QDK is a full-featured development kit for Q# that you can use with tools and languages to develop quantum applications that you can run in various environments. Q# programs can run as a command-line app, through Jupyter Notebooks, or use a Python or .NET host program.

Qiskit Language

Perhaps the “python” of quantum world. Qiskit has been around for a long time (short in real terms, but long on the quantum world), in fact: 3 years and is supported by IBM though it is open source and used by many. It has a huge following in and out of academia and industry is is pretty easy to learn and being widespread means you’ll find a huge code-base already out-there.

As you’d expect there is widespread adoption and support from IBM and can work on a variety of hardware. The syntax is fairly logical for most programmers to pick-up. There are also plenty of training resources (FREE and otherwise) for the language.

One fantastic book for learning Qiskit and quantum programming is a book authored by Bob Sutor called dancing with qubits, where you’ll learn quantum concepts and their language constructs.

Open Cirq

One of the tech giants (Google) is behind and supports the language and framework. One of the newer languages at only two years old, cirq has a growing following. There are a growing number of adopters such as QC Ware, Zapata and more being announced all the time.

If you want to learn both quantum fundamentals and the languages there is a book written by Jack Hidary from Google X who expertly explains how to employ the language to manipulate qubits and build circuits.

Strawberry Fields and PennyLane

Emerging from Xanadu, the language has emerged from the photonic quantum computing company that is working on building a light based quantum computer. It is fundamentally quite different in that it is more hardware specific, but that doesn’t mean you cannot use it to simulate quantum circuits.

If you want to work on Quantum Machine Learning then you may also want to look at the python library (PennyLane) from Xanadu which enables you to do QML in a high level way. There are excellent documentation materials and whilst Xanadu is technically a quantum start-up it has major backing and the tools are being utilized by many many companies and organizations. There is massive active research base in QML at Xanadu which gets rapidly adopted into tooling and frameworks. So if you want to understand one of the hottest areas in Quantum (QML), check out one of the tutorials.

What language? So many to choose from?

There are new languages popping up all the time and we haven’t covered some of the languages such as Silq (which we covered a short time) ago which aims to be a much higher level language quantum computing language. There are other langues such as PyQuil (from Rigetti), Quipper, [we can go on], but we wanted to cover some of the more popular in-use languages.

Like classical languages, the fundamentals of gate based quantum computers don’t change and would recommend that learners focus on languages which familiarize them with operating on qubits, doing operations such as Pauli X, Y, Z and controlled operations for example (CNOT etc etc). And those languages where there are plenty of code examples, a strong user base and active researchers. Sure, some of it comes around to preference, for example this author quite likes the syntax of cirq over qiskit, but the advantages of the latter is there is a larger code base and user community.

Better than learning one language is to learn a couple. There is perhaps no better way to get to grips with quantum computing, then by seeing the same functionality with different syntax and constructs.