An introduction to quantum computing
A Search Algorithm
Lov Grover developed the brute force search method, which is a good example of a complex quantum algorithm. Suppose that, given 65536 inputs, I need to find the one with a special property. Let's call this the match. Perhaps the inputs are the nodes of a network, and I am looking for one that is not connected. Or, for a cryptographic function, I might be looking for the input value that belongs to an output value I have.
For simplicity's sake, there will be exactly one such match. Additionally, I will assume that I know a test algorithm that determines for each input whether the input is the match. I now convert the test algorithm into a quantum circuit, where 1 is returned for the match and 0 for all other inputs. This circuit now in turn provides the input, known as the quantum oracle, for Grover's search algorithm.
Grover's algorithm first generates a superposition for all 65536 inputs. Each amplitude is given a value of 1/256, since 256 x 256 totals 65536. To do this, you can initialize 16 qubits with 0> and apply H to each of them. I also need an auxiliary bit. Quantum parallelism lets me do the following with a single application of the oracle: The amplitude of the match flips 1/256, while all others remain at 1/256.
A measurement would not give any indication of the match. But you can take advantage of the fact that this is singled out within the superposition by the negative sign. Next, apply a circuit that mirrors each amplitude at the mean value of all amplitudes. This firstly makes the amplitude of the match positive again while secondly increasing it. All other amplitudes decrease accordingly. These two steps (negating the amplitude of the hit and mirroring at the mean) are known as the Grover iteration. When applied again, the amplitude of the match grows. In our case, we repeat it 200 times. After that, a measurement gives the match with a high level of probability.
The number of Grover iterations is in the order of the square root of the number of possible inputs. Compared to classical computers, this results in a quadratic acceleration. In all cases, the result is not the actual match, but something with a high probability of being the match. But this uncertainty is not a problem in practice. You can check Grover's results with the test algorithm. Doing so means that you can either confirm that you have the hit, or you need to rerun Grover's algorithm.
Suppose the probability of error is a very high 5 percent. Then the probability of getting a wrong result twice would be 0.05 x 0.05 or 0.25 percent. The algorithm would get things wrong a third time in just 0.0125 percent of all cases. In other words, the error rate drops exponentially as the number of repetitions increases.
Outlook
Armed with this basic knowledge, you can now confidently move on to some handson work. The next article explores the Qiskit framework for programming quantum algorithms.
Infos
 Braket notation: https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation
 Quantum algorithms: https://quantumalgorithmzoo.org
 Quantum annealing: https://en.wikipedia.org/wiki/Quantum_annealing
 Simulated annealing: https://www.cs.cmu.edu/afs/cs.cmu.edu/project/learn43/lib/photoz/.g/web/glossary/anneal.html
« Previous 1 2 3
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when youâ€™ve found an article to be beneficial.
News

SUSE Offers CentOS 7 Spport with Liberty Linux Lite
SUSE's Liberty Linux support offering now includes CentOS 7, which means businesses won't be forced to migrate those servers for some time.

Ubuntu's App Center Finally Supports Local Installs Again
If you regularly download .deb files and would prefer a GUI method of installing, Ubuntu has your back.

AlmaLinux Now Supports Raspberry Pi 5
If you're looking to create with the Raspberry Pi 5 and want to use AlmaLinux as your OS, you're in luck because it's now possible.

Kubuntu Focus Releases New Iterations of Ir14 and Ir16 Laptops
If you're a fan of the Kubuntu Focus laptops or have been waiting for the right time to purchase one, that time might be now.

NixOS 24.05 Is Ready for Prime Time
The latest release of NixOS (Uakari) has arrived and offers its usual reproducible, declarative, and reliable goodness.

Linux Lite 7.0 Officially Released
Based on Ubuntu 24.04 and kernel 6.8, Linux Lite version 7 now offers more options than ever.

KaOS Linux 2024.05 Adds Bcachfs Support and More
With updates all around, KaOS Linux now includes support for the bcachefs file system.

TUXEDO Computers Unveils New Iteration of the Stellaris Laptop Line
The Stellaris Slim 15 is the 6th generation and includes either an AMD or Intel CPU

KDE Releases Plasma 6.0.5
The latest release of the Plasma desktop has arrived with several improvements and the usual bug fixes.

Gnome OS Adopting systemdsysupdate
Gnome OS is about to undergo a major underthehood change that promises enhanced security.