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 hands-on work. The next article explores the Qiskit framework for programming quantum algorithms.
Infos
- Bra-ket 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/learn-43/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
-
Canonical Releases Ubuntu 24.04
After a brief pause because of the XZ vulnerability, Ubuntu 24.04 is now available for install.
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.