Quantum Computers and the Future of Programming
Quantum algorithms are a key element of quantum computing, but how exactly do they work?
Actuaries are familiar with coding on PCs in high-level programming languages such as Python, but it wasn’t always like that.
The first digital programmable computer, Colossus, built in the UK in 1944, used thermionic valves and was programmed using switches and patch wiring – there were no programming languages as such back then. It occupied almost a whole room at Bletchley Park where it was assembled.
Fast forward 80 years to today and most of us carry a computer many times more powerful than Colossus in our pocket in the form of smartphones. Incidentally, they are also far more advanced than those onboard the Apollo spacecraft that took astronauts to the moon in the 1960s and 1970s!
The present situation with quantum computers is analogous to Colossus. They are currently large, not very powerful and don’t have high-level, general purpose programming languages. However, just as with classical computers, we can reasonably expect that all that will change over time, and we will eventually have much more powerful (quantum) computers than we do today.
Quantum circuits
Most researchers expect that quantum computers will use circuits based on quantum gates like the electronic circuits based on boolean gates used in classical computers, but we should note that this is not the only possible model discussed by theorists. Quantum algorithms use quantum circuits to manipulate qubits and perform calculations.
In part 2 of The Weird World of Quantum Computers, we discussed the experimental approaches to developing quantum computing hardware. But what about the software?
Quantum algorithms
We are also still at the beginning of knowing how to program quantum computers. At the moment there are no general purpose programming languages for true quantum computers, just a small number of quantum algorithms which are more akin to machine code in classical computers than high level programs. The best known are the first two to be developed, Shor’s and Grover’s algorithms.
Shor’s algorithm
In 1994, mathematician Peter Shor devised an algorithm that exponentially speeds up the factorisation of large semiprime numbers relative to the fastest known classical algorithm. Shor’s algorithm was the first to show that quantum computers could, in theory, exponentially speed up certain calculations and has been a major driver behind interest and investment in quantum computing.
Shor’s algorithm is based on a technique called quantum Fourier transforms. These are the quantum analogues of the discrete Fourier transforms that are used extensively in digital signal and image processing and many other fields. An application that most of us are familiar with is processing and editing images taken with digital cameras. The Fourier transform gives the frequency distribution of a signal or image – similar to analysing the harmonics of a note played on a musical instrument.
Grover’s algorithm
In 1996, computer scientist Lov Grover devised an algorithm for searching unsorted databases; for example, searching a database of names in random order to find the email address of a colleague. Grover’s algorithm uses a technique called quantum amplification in which the state we are looking for (the colleague’s name in our example) is amplified so that it has a high probability when we make the measurement of the quantum system.
Grover’s algorithm quadratically speeds up the search. Given the time taken to set up the initial qubits, this may mean that, in practice, it doesn’t find the answer faster than a classical computer.
It is important to note from these two examples that quantum algorithms don’t uniformly increase calculation speed over classical computing, and for some calculations may not improve it at all. Other calculations will, however, be completed much faster on quantum computers.
Other quantum algorithms
Many of the quantum algorithms that have been developed to date are based on the quantum Fourier transform, amplitude amplification, and a third technique called quantum walks, which is the quantum analogue of the classical random walk.
Techniques like these, and others yet to be developed, may ultimately lead to more generalised approaches to quantum programming.
One day, you will be able to program your quantum computer in a high-level programming language like Python.
CPD: Actuaries Institute Members can claim two CPD points for every hour of reading articles on Actuaries Digital.