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.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.