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)