How Classic software developers can learn Quantum Computing

How Classic Software Developers Can Learn Quantum Computing

Please note: This article contains affiliate links.

The quantum revolution is on its way. Whilst researchers are still finding the killer applications that take Quantum Computing into prime time that hasn’t stopped developers learning the basis of Quantum Computing and how to program qubits in a range of devices and simulators that come from the Likes of IBM, Microsoft and Google plus start-ups such as CQC (Cambridge Quantum Computing) and Xanadu.

The Art of the Start

The best way to learn anything is to start. Sounds obvious, but actually doing something is better than pontificating about the best way to learn. But in case you are lost, we have collected some of the better resources from around the web that can help you learn how to program Quantum Computers. Our aim here is to provide a softer gentler but more robust way of approaching and learning to program a quantum computer.

The Almighty Qubit

You might have heard the Qubit mentioned in common parlance, but this isn’t just an ordinary “quantumified” ordinary bit but presents a truly radical departure from the classical way of thinking about information and bits. It is for that reason that we suggest getting intimately acquainted with qubits at the fundamental level before thinking about running to the next level and trying to program vast numbers of these! Get a good foundation of the qubit and it’ll set you up for a lifetime of quantum learning.

There are plenty of resources out there on the qubit. Even Wikipedia does a pretty good job, but if its the first time to look at quantum computing you might be thrown by the terms such as Block sphere and for that reason we should point you in the direction of some key resources that are aimed for people from a classical programming background.

Classical bits are pretty easy to comprehend, there are two states – exactly. A bit lives in one of these two states, 0 or 1. It doesn’t matter how these states are embodied. These states can be recorded into stone if needed and the binary read by your finger if so required. For the most part, thankfully, we don’t use stone, but modern day classical computers do you use a variety of media for storing these bits, for electrical voltage, charge, magnetic spins, but on CD are actually more like the stone analogy. Qubit’s on the other hand are a strange beast that have more than these two states and this is where the Bloch sphere is introduced – and whilst we won’t labour the point, understanding the fundamentals of the Bloch sphere are key, just like the bit, how its embodied isn’t of relevance for most people and you can simply accept that the hardware exists.

Imagine at a fundamental level, qubits do not have to exist in any one state. Lets keep it simple and that means that each qubit in each device can have an undetermined state. If this seems confusing, this is now the time to head out on your own and find out about the Bloch sphere and how to manipulate it. For much of Quantum Computing and the programming you do will be manipulating these qubits, just as you do at an abstracted level with classical programming.

Old Computers Used Paper Tape To Store Information. Bytes Are Punched Into A Row Of Bits And Are Then Physically Read. Modern Computers Still Use Bits, But Not Paper Tape.
Old computers used paper tape to store information. Bytes are punched into a row of bits and are then physically read. Modern computers still use bits, but not paper tape.

Modern day classical computing uses many layers of abstraction. Performing an operation in Python such as multiplying a number by the integer two, for example multiplying 15 by 2, we often take for granted that the can do this with simplicity, but have you every considered what is happening under the hood at the bit level? Qubit operations will take you to the fundamentals of how manipulation at the lowest level can yield the operation that is desired. For example to multiply our number by two in the classical world, we can shift the bit representation left (LSR or Left Shift Register) and that is how we can quickly perform some calculations at a low level. But the programmer typically never needs to worry about this because they are so far abstracted from the actual registers, high in the cloud in the high level language like Python or Julia. Of course it is the job of the interpreter or compiler to find the most efficient way of performing the requested operation. In the Quantum world you’ll need to accept that there isn’t much in the way of the high level operations and that you’ll need to get to grips with the basics.

Starting with the Qubit

There are some great resources on the web (for example YouTube), but if you want something more formal you might like to look at the free Textbook provided by Qiskit which is one of the most popular programming languages for Quantum Computers out there. In fact there are other languages out there and we’ll discuss some of these later. But your first goal should be to understand the qubit and that is language independent. Where you go after that is up to you!

Getting started with a Quantum Programming Language

This is where things tend to get partisan and a little heated. Just like classical languages there are a few to choose from. Perhaps the best way like many languages in the early stage is to go for languages that are well supported with quite a few users. The Languages such as Qiskit, Cirq and Q# are all backed by large technology companies.

  • Qiskit is open source and backed by IBM
  • Cirq is open source and backed by Google
  • Q# is open source and backed by Microsoft

Without getting partisan, Qiskit would seem on balance the most popular (again this can get into dangerous water) because there are newer languages and its hard to define metrics. But if we look at number of articles on Qiskit vs Cirq vs Q# on Google search engine we see that Qiskit has 160,000, Cirq has 94,900, and Q# around 114,000 results. So it would seem that Qiskit seems the winner in a loose hand-wave sort of way. But you are likely to be in good company with any of these these three languages.

There are other languages such as Quil / PyQuil, t|ket>, QASM etc, etc, but we won’t focus on these, but again if you learn the basics you can migrate reasonably easily between these languages.

Books on Quantum Programming

This segment is growing in popularity and there are two main books I would say aimed squarely at the classical programmer who wants to get to grips with Quantum Programming. The two books we have read are Dancing with Qubits (Based around Qiskit) and Quantum Computing: An Applied Approach (Cirq).

Again not wanting to sound partisan, we speak to a lot of people and know that Dancing with Qubits is popular with learners because of not only the style but because it is based on Qiskit. Don’t disregard other books though, for Cirq is a great language (I personally quite like the syntax) and Jack Hidary’s book: Quantum Computing: An Applied Approach, does a good job of explaining some of the fundamentals of quantum computing.

Online Courses for Quantum Programming

As online learning becomes increasingly popular. It’s not any surprise that there are courses which can help you learn the basics of Quantum Computing and Quantum Programming. We have a entire page of Online courses in Quantum Computing. If you want something dedicated to the basics, do consider the very fun and well designed Quantum Computing course from Brilliant which keeps the fun alive when learning about qubits, gates and how to build up larger systems. With the course designed with help from Alphabet X and Microsoft you can expect a high quality series of learning materials.

It’s not too late to learn Quantum programming

Learning now whilst in a state of immaturity means that you’ll be open and flexible to all of the likely changes that will occur over the coming years. Each week we are seeing major technological advances that bring Quantum Computers ever close to prime time. Getting to grips with the basics now will mean that future development should be a little easier once you know the basics.

You don’t need access to a Quantum Computer to start

Quantum circuits can be simulated. There is no real need to run on an actual quantum computer unless you actually need to. Most development work is done using a simulator, for example all the frameworks and languages use two modes: Simulated and Quantum.

That means that you can pretty much run Quantum circuits anywhere and have them simulated by the framework. Of course we advocate running at least one quantum circuit just to “cut your teeth” and achieve your first Quantum circuit running on Quantum Hardware, but for most applications you simply do not need a Quantum Computer/ Of course as complexity increases of circuits simulation will prove more difficult – hence the reason Quantum Computers are interesting!

You can simply get on the cloud when you want to run on Quantum hardware, but there are some easy ways to start building and programming with many languages on just about any standard machine, Microsoft Windows, Mac and Linux. In fact to start with the likes of IBM Q’s service, you just need a browser!

Quantum Programming can be done just about anywhere, even your browser

Quantum IDE’s

Oh No! not another three letter acronym? But how should you actually interact with code? Well, for the IDE or Integrated Development Environment, you can go without or choose one to write in the language of your choice and so long as you can run that code you are fine. As you might expect, Microsoft have done a pretty good of building up the relations between languages and an environment that makes it easy to code. The acclaimed Visual Studio has been the tool of choice for many developers over decades, so it comes as no surprise that Visual Studio allows developers to easily integrate with Q# (Q sharp).

Running Q# Code In Microsoft'S Visual Studio Code Ide Which Allows The Integration Of Simulators To Run The Q# Code.
Running Q# code in Microsoft’s Visual Studio Code IDE which allows the integration of simulators to run the Q# code.

If you want an easy place to start that feels familiar, you might like to consider Microsoft QDK or Microsoft Quantum Development Kit. Building on the smaller IDE: Visual Studio Code, which is for free, you can download the editor, and start running your code. Again, as you’d expect Microsoft also integrates into Microsoft Azure, which allows you to run Quantum circuits with Quantum Azure.

RTFM or NOT.

We all don’t like reading documentation and many will be happy to find easy ways to start programming their first circuit without installing a thing. IBM have made it pretty easy to start. Just get an account and you can be running your first Quantum Program or circuit in minutes.

For an easy place to start IBM Q does a pretty good job of removing the barrier to you running your very first circuit and you can do this via your browser without downloading a thing. There you can explore Qiskit syntax and run your first Quantum program.

Using The Qiskit Framework And Language Within The Ibm Q Experience. Jupyter Notebooks Are Integrated Which Allow A Seamless Transition Between Pictorially Represented Gates And Qiskit Code.
Using the Qiskit framework and language within the IBM Q experience. Jupyter notebooks are integrated which allow a seamless transition between pictorially represented gates and Qiskit code.