Is Quantum Search Practical?
Total Page:16
File Type:pdf, Size:1020Kb
Q UANTUM C OMPUTING IS QUANTUM SEARCH PRACTICAL? Gauging a quantum algorithm’s practical significance requires weighing it against the best conventional techniques applied to useful instances of the same problem. The authors show that several commonly suggested applications of Grover’s quantum search algorithm fail to offer computational improvements over the best conventional algorithms. ome researchers suggest achieving mas- polynomial-time algorithm for number factoring sive speedups in computing by exploiting is known, and the security of the RSA code used quantum-mechanical effects such as su- on the Internet relies on this problem’s difficulty. perposition (quantum parallelism) and If a large and error-tolerant quantum computer Sentanglement.1 A quantum algorithm typically were available today, running Shor’s algorithm on consists of applying quantum gates to quantum it could compromise e-commerce. states, but because the input to the algorithm Lov Grover’s quantum search algorithm is also might be normal classical bits (or nonquantum), widely studied. It must compete with advanced it only affects the selection of quantum gates. Af- classical search techniques in applications that use ter all the gates are applied, quantum measure- parallel processing3 or exploit problem structure, ment is performed, producing the algorithm’s often implicitly. Despite its promise, though, it is nonquantum output. Deutsch’s algorithm, for in- by no means clear whether, or how soon, quantum stance, solves a certain artificial problem in fewer computing methods will offer better performance steps than any classical (nonquantum) algorithm, in useful applications.4 Traditional complexity and its relative speedup grows with the problem analysis of Grover’s algorithm doesn’t consider the size. However, Charles Bennett and his col- complexity of processing the so-called oracle leagues2 have shown that quantum algorithms are queries—that is, certain questions with yes or no unlikely to solve NP-complete problems in poly- answers. The query process is simply treated as a nomial time, although more modest speedups re- black box, thus making Grover’s algorithm appeal- main possible. Peter Shor designed a fast (poly- ing because it needs fewer queries than classical nomial-time) quantum algorithm for number search. However, with sufficiently time-consuming factoring—a key problem in cryptography that query processing, Grover’s algorithm can become isn’t believed to be NP-complete. No classical nearly as slow as a simple (exhaustive) classical search. In this article, we identify requirements for 1521-9615/05/$20.00 © 2005 IEEE Grover’s algorithm to be useful in practice: Copublished by the IEEE CS and the AIP GEORGE F. V IAMONTES, IGOR L. MARKOV, AND JOHN P. H AYES 1. A search application S where classical meth- University of Michigan ods don’t provide sufficient scalability. 2. An instantiation Q(S) of Grover’s search for 22 COMPUTING IN SCIENCE & ENGINEERING Grover’s Quantum Search Algorithm evaluated on a superposition of all database items. Addi- rover’s quantum algorithm searches for a subset of tionally, converting classical search criteria to quantum cir- Gitems in an unstructured set of N items.1 The algo- cuits often entails a moderate overhead, and the quantum rithm incorporates the search criteria in the form of a black- predicate’s complexity can offset the reduction in the num- box predicate that can be evaluated on any items in the ber of queries. set. The complexity of this evaluation (query) varies de- Figure A shows a high-level circuit representation of pending on the search criteria. With conventional algo- Grover’s algorithm. (See related research2,3 for more de- rithms, searching an unstructured set of N items requires tailed circuits.) The algorithm’s first step is to initialize ⑁(N) queries in the worst case. In the quantum domain, log(N) qubits, each with a value of |0ñ. These qubits are however, Grover’s algorithm can perform unstructured then placed into an equal superposition of all values from 0 search by making only O(N ) queries, a quadratic to N – 1 (encoded in binary) by applying one Hadamard speedup over the classical case. This improvement is con- gate on each input qubit. Because the superposition con- tingent on the assumption that the search predicate can be continued on p. 24 R iterations |0 Iteratively increase the . Measure qubits to Create an equal probability amplitudes log(N) . retrieve one of the superposition of of index states which qubits matching indices . indices to N items match the search criteria probabilistically |0 Workspace qubits Black-box Predicate: Is f(x) = 1? Search criteria Repeat to find multiple matching indices Figure A. A high-level circuit depiction of Grover’s quantum search algorithm. S with an asymptotic worst-case runtime, a given criterion. (See the “Grover’s Quantum which is less than that of any classical algo- Search Algorithm” sidebar for a more detailed de- rithm C(S) for S. scription of this algorithm and its implementa- 3. A Q(S) with an actual runtime for practical tion.) For any N-element database, it takes instances of S, which is less than that of any ~NM/ evaluations of the search criterion C(S). (queries to an oracle) on database elements, whereas classical algorithms provably need at least Yet, we also show that real-life database applications ~N evaluations for some inputs. rarely satisfy these requirements. We also describe a To search a (large) database used in a particular simulation methodology for evaluating potential application S, Grover’s algorithm must be supplied speedups of quantum computation for specific in- with two different kinds of inputs that depend on stances of S. We demonstrate that search problems S: often contain a great deal of structure, which sug- gests several directions for future research. · the database, including its read-access mech- anism, and Quantum Search · the search criteria, Grover’s quantum algorithm1,5,6 searches an un- structured database to find M records that satisfy each of which is specified by a black-box predicate MAY/JUNE 2005 23 continued from p. 23 ⎢π ⎥ tains bit strings, they’re thought of as indices to the N items ⎢ arcsin() M / N ⎥ R = rather than as the items themselves. ⎢ 4 ⎥ . ⎣⎢ ⎦⎥ The next step is to iteratively increase the probability am- plitudes of those indices in the superposition that match Grover’s algorithm also exhibits a periodic behavior, and af- the search criteria. The key component of each iteration is ter the amplitudes of sought elements peak, they start de- querying the black-box predicate. We can view the predi- creasing. cate abstractly as a function f(x) that returns 1 if the index x In the final step, quantum measurement is applied to matches the search criteria and 0 otherwise. Assuming that each of the log(N) qubits, producing a single bit string. The the predicate can be evaluated on the superposition of in- larger a bit string’s amplitude, the more likely the bit string dices, a single query then evaluates the predicate on all in- is to be observed. dices simultaneously. In conjunction with extra gates and When M items match the search criteria in a particular qubits (or workspace qubits), the indices for which f(x) = 1 search problem, then Grover’s algorithm produces one of can be marked by rotating their phases by radians. To them. Each item is equally likely to appear because the in- capitalize on this distinction, additional gates are applied to version about the mean process increases the probability increase the probability amplitudes of marked indices and amplitudes of matching items equally. If all such items must decrease the probability amplitudes of unmarked indices. be found, Grover’s algorithm might have to be repeated Mathematically, this transformation is a form of inversion more than M times, potentially returning some items more about the mean. It can be illustrated on sample input than once. On the other hand, classical deterministic search {–1/2, 1/2, 1/2, 1/2} with mean 1/4, where inversion about techniques avoid such duplication and might be more suit- mean produces {1, 0, 0, 0}. Both vectors in the example able in applications in which M is a significant fraction of N. have norm 1. In general, the inversion about mean is a uni- tary transformation. One of Grover’s insights was that it can References be implemented with fairly small quantum circuits. 1. L.K. Grover, “Quantum Mechanics Helps in Searching for a Needle in a In the case in which only one element out of N satisfies Haystack,” Physical Rev. Letters, vol. 79, no. 2, 1997, pp. 325– 328. the search criterion, each iteration of Grover’s algorithm in- 2. M.A. Nielsen and I.L. Chuang, Quantum Computation and Quantum In- creases the amplitude of this state by approximately formation, Cambridge Univ. Press, 2000. O(1/N ). Therefore, approximately N iterations are re- 3. G.F. Viamontes, I.L. Markov, and J.P. Hayes, “More Efficient Gate-Level quired to maximize the probability that a quantum mea- Simulation of Quantum Circuits,” Quantum Information Processing, vol. surement will yield the sought index (bit string). For the 2, no. 5, 2003, pp. 347–380. more general case with M elements satisfying the search 4. M. Boyer et al., “Tight Bounds on Quantum Searching,” Fortschritte der criteria, the optimal number of iterations4 is Physik, vol. 46, no. 4–5, 1998, pp. 493–505. or oracle p(x) that can be evaluated on any record x dex. of the database. The algorithm then looks for an x Researchers are aware of several variants of such that p(x) = 1. In this context, x can be ad- Grover’s algorithm, including those based on quan- dressed by a k bit string, and the database can con- tum circuits and different forms of adiabatic evolu- tain up to N = 2k records.