Abstract
The Grover algorithm is a crucial solution for addressing unstructured search problems and has emerged as an essential quantum subroutine in various complex algorithms. By using a different approach with previous studies, this research extensively investigates Grover’s search methodology within non-uniformly distributed databases, a scenario frequently encountered in practical applications. Our analysis reveals that the behavior of the Grover evolution differs significantly when applied to non-uniform databases compared to uniform or ‘unstructured databases’. Based on the property of differential equation, it is observed that the search process facilitated by this evolution does not consistently result in a speed-up, and we have identified specific criteria for such situations. Furthermore, we have extended this investigation to databases characterized by coherent states, confirming the speed-up achieved through Grover evolution via rigorous numerical verification. In conclusion, our study provides an enhancement to the original Grover algorithm, offering insights to optimize implementation strategies and broaden its range of applications.
Subject terms: Physics, Quantum physics, Quantum information
Introduction
The Grover algorithm, conceived by L. K. Grover in 19971, marked a significant advancement in the field of quantum computing2, particularly in addressing the challenge of query complexity. In the classical paradigm, searching an unstructured database typically necessitates n steps, where n is the size of the database. Grover’s groundbreaking algorithm, however, revolutionizes this approach by reducing the required steps to merely . This quantum search algorithm has emerged as a cornerstone in the development of quantum computational routines, celebrated for its ability to significantly amplify the amplitude of the quantum state that encodes the desired information. The versatility and applicative potential of the Grover algorithm have been demonstrated across a spectrum of challenging problems. For instance, it has provided innovative solutions to the satisfiability problem3, as well as in the burgeoning field of quantum machine learning4. Further applications include tackling constrained polynomial binary optimization5 and enhancing quantum amplitude estimation techniques6, showcasing a clear computational superiority over traditional methods. Recent explorations have extended the utility of the Grover algorithm7 to the domain of adiabatic quantum computing8–10, underscoring its adaptability and relevance in the rapidly evolving landscape of quantum research. This paper specifically delves into the algorithm’s seminal application in database searching, highlighting its transformative impact and ongoing significance in the quest for efficient quantum computing solutions. Through this focus, we aim to illuminate the enduring value and broad applicability of Grover’s algorithm1,11,12, from its initial proposal to its current and potential future contributions to quantum computing and beyond.
The search problem unfolds as follows: within a given database, each element is distinctly indexed. When the database is of finite size, locating a specific element necessitates iterative queries to its index. Typically, the query count scales with the database size. Grover’s seminal work explored this quandary in the realm of quantum computing. Through specific evolution operators, the amplitude of the basis state housing the target data can be boosted to unity. The steps required for such enhancement scale proportionally to the square root of the database size, ensuring a guaranteed quadratic acceleration. This concept has been integrated into numerous platforms13–15, with additional advancements showcased in recent proposals16–19.
The initial discourse on the search dilemma predominantly centers on managing unstructured databases, following a conventional approach in theoretical computational discussions that remains detached from specific physical contexts. However, as we transcend the limits imposed by current computing platforms and strive for advancements, particularly in the evolution of novel computing architectures, data encoding states may not uniformly distribute. Thus, delving into the potential enhancements of the Grover search algorithm in such scenarios presents an opportunity to broaden its utility and applicability significantly.
Moving forward, we conduct an analysis of the aforementioned issue. The database under scrutiny is comprehensive, characterized by distributions spanning various types. Similar topics have been discussed before20,21, in which a general form of the Grover evolution is given. Different from the previous method, we analysis the necessary steps for executing the search operation by using the asymptotic differential equation of the algorithm. By using the property of differential equation, we methodically identify the prerequisites for achieving acceleration through Grover evolution. Subsequently, we showcase two illustrative examples to elucidate our observations: the first example validates the harmony between our theory and Grover’s established results, while the second one exemplifies that employing the Grover search on a database governed by coherent state probabilities leads to acceleration compared to conventional methods. It indicates our algorithms can be carried out in non-universal quantum computation like linear optical system used in implementing Boson sampling. The initial state can be prepared as weak coherent states depending on cutting of N. This is followed by an elaborate exposition of our overarching methodology.
Grover search on weighted databases
Consider a database , with integer M. An arbitrary element in the database is a real number, which represents a certain characteristic of objects. In the original version of search problems, all s are distinct to each other. A example of the problem could be as follows. One could consider the above database as a collection of the length data of many pencils, and represents the length of the nth pencil. If the length of pencils are measured precisely enough, there will be no pencils with the same lengths. Hence, the search for the series number of the pencil with a particular length in the database could be the described by the search problem of this kind. However, in practice, some characters of the objects do not need to be handled at an extremely high precision. Going back to the pencil example, if one re-perform the statics and categorize the lengths of the pencils into several length intervals, there would be more than one pencil in one interval. Furthermore, if the pencils whose lengths fall into one length interval are numbered identically, a natural target under this case could be finding the series number of a demanded length interval. This goes into the problem of what we called the weighted database search. Formally, suppose that there are N distinguished types of elements in a database, denoted by . Therefore, the database can be given by , where represent the proportions of distinct characteristics in the total database. An illustration of the search problem on the databases is given by Fig. 1.
To search for a certain characteristics in , by using classical algorithms, the required number of steps s is proportional to the reciprocal number of its proportion. Therefore, in general, s satisfies
1 |
To perform the same task by using Grover evolution22, one can consider the following state
2 |
is a set of orthonormal basis and is a superposition of them. P(n) is the complex amplitude of the basis state , yielding that , and . Notice that Eq. (2) can represent a state whose amplitudes of each basis state can be arbitrary. In the usual consideration of quantum computing, it is not always easy to prepare a state according to the distribution of given database. It is known that, for instance, the quantum state for encoding unstructured database, as considered by Grover, can be efficiently prepared by Hadamard gates on qubits. Also, the database distributed like a coherent state, which is an exponential distribution modified by several factors, can be prepared by displacements on harmonic oscillators in a continues-variable quantum computing setup. We will discuss the two cases later. In a general sense, a quantum computer could be any of quantum systems that can be well controlled. Hence, the initial state of the system, such as its ground states, might be not distributed uniformly in its natural basis. This could also be applied for searching the database with the same or close distribution, as indicated by Eq. (2). Because our aim in this work is discussing the Grover search based on Eq. (2) in a general sense, we do not go further into the preparation strategy of states with other distribution. We would like to discuss them broadly in our future investigation.
According to the idea of Grover search, the amplitude of the target state can be amplified by repetitive evolution so that the search can be completed by only one step. Then, the total step number of performing the search equals to the repeat number of the evolution operators. Suppose that the target state is , the basic two operators for evolution are defined by
3 |
The amplification operator required by Grover search is defined by . Suppose that after performing G for t times on , the whole state evolves to . Then, the step number for searching is given by t.
The next key problem is to compare the step numbers of the two methods, validating whether a speed-up exists. For such purpose, we analyze the above evolution under G as follows. Applying G once to the state , one has
4 |
Furthermore, if G is applied for r times, a recurrence relation can be obtained,
5 |
where
6 |
For sufficient large r, the amplification leads to that and . This asymptotic behavior can be seen by approximating with a continuous function with real variable x, such that . Apply the approximation , and the same for . Thereafter, two partial differential equations can be obtained, shown by
7 |
Substitute the second equation to the first equation, one has
8 |
Notice that such equation is a standard second-order partial differential equation. Its solution has been discussed thoroughly. In general, the solution of can be given by
9 |
where with . and are constants depending on initial conditions. and are the real and imaginary part of complex when . In our case, so that . The case when means that state can be searched with one step, which is trivial and is not considered here. Thus, the solution to Eq. (8) is
10 |
where . The dynamics given by Eq. (10) is a damping oscillation. The period of the oscillation is . It indicates that in the time of T, there is a moment when takes its maximum, approaching to be one. Therefore, the steps number for the search is in the order of T. The speedup of the Grover search under the condition can be verified by comparing the order of T and s. More strictly, one has the condition
11 |
The condition given by Eq. (11) indicates a global speed up over the classical treatment. Notice that we omit the constant factor because it does not affect the order. If one limits the problem to searching the kth element in the database, the condition can be loosen to
12 |
Then, because |P(k)| is not zero generally,
13 |
Such a condition indicates a local speed up over the classical treatment, which is only effective for searching one element. Obviously, the inequality holds when . It is easy to satisfy such condition when N is sufficiently large.
In what follows, we provide two specific examples of the above general analysis. In the first example, we show that the original unstructured search by Grover’s idea can be obtained from our consideration. In the second, we show the results when the distribution of database is that of a coherent state. We also check the effectiveness of the contentious form given by Eq. (7) in the two examples.
Two examples
I. Back to unstructured search. The case of unstructured search can be easily obtained by setting . The solutions of Eq. (6) and the approximation in this example are compared in Fig. 2, when . The amplitude of and are obtained by solving Eq. (6) step-by-step under the condition and . The approximation and are obtained by using the 3rd equation of Eqs. (9) under the condition and . From the plots, it can be seen that the locations of the maximum of and are nearly the same with those of and . Hence, the approximation is valid.
Then, the scale of the step number for the search problem can be estimated by
14 |
When N is big enough, one has . Therefore, the step number for Grover search is in the order of . It worth mentioning that, in such a case, because for big N, the factor is close to one. It guarantees finally approaches to one.
The classical search algorithm on the unstructured database is basically checking each elements in the database one by one. Because the probability of finding one element is 1/N, the step number for the searching by classical treatment is in the order of N. Hence, a quadratic speedup can be observed by comparing the order of the two step numbers.
II. Grover search by using coherent state. In this part, we consider the case when the distribution of database satisfies (or partially satisfies) the distribution of the coherent state. The coherent state in the particle number basis can be expressed by
15 |
where is a complex number. Such a state is a natural state in optical amplification cavity. Notice that there are infinite basis states in the coherent state. Therefore, for finite databases, one can consider encoding them into parts of the state (15). Define the N-dimensional database state ,
16 |
where is the normalization factor, given by
17 |
Thus, for a target state in the database, one has,
18 |
Notice that, when is large enough, slowly varies with k. Thus, the case will go back to the unstructured database, as shown in the first part of this section. When is not large enough, the magnitude of |P(k)| is given by and . We numerically provide several cases shown in Fig. 3. The solutions of Eq. (6) and the approximation in this example are compared in Fig. 4. The searching target is the basis state when , and the rest parameters are set to be the same with those for Fig. 3. The amplitude of () and its approximation () are obtained by the same method of the first example. The initial conditions are also the same. From the plots, it can be seen that the locations of the maximum of and are also approximately the same with those of and . The major difference lies in the damping of and , resulted from the factor . In the finite cases, one could just neglecting the factor for the estimation of the locations of the maximum. Because such a factor has no affection on the locations. Further, as in the first example, it can be seen that the factor approaches to one when |P(k)| is small enough. Such a condition is better met if the database is large. Therefore, the method can be used to estimate the scale of step number when the size of database goes to infinity.
By substituting the probability distribution to , the order of the step number can be estimated by the magnitude of . The step number of the classical treatment is obtained by when searching for . In order to show a clear comparison, we firstly compare the reciprocal of the step numbers of the two cases, and the results is shown in Fig. 5. In fact, reciprocal of the step number in classical search for is just its probability . Extended from the classical concepts, the reciprocal of the step number in Grover search, which is , represents an effective probability of “searching for ”. The comparison between the two reciprocals are equivalent to the comparison of the step number, but with an inverse trend. The smaller step number indicates a larger reciprocal, and vice versa. From the results, we can see that in general, the Grover evolution is a better strategy over the classical treatment. An exception occurs in Fig. 5a, when searching for the first element. This is because is relatively small in such a case. We secondly compare the natural logarithm of the step numbers of the cases, and the results are shown in Fig. 6. By Fig. 6, a clear advance in steps number can be observed, and the exception also occurs in (a). The results in Figs. 5 and 6 indicate that the Grover search on a database distributed in the probability given by the coherent state is able to show an advance over the classical methods. According to our conditions in the second section, such an advance belongs to the local speedup.
Conclusion
By using the property of differential equation, we investigate the application of Grover’s algorithm for weighted database searches, a prevalent scenario in practical settings. We calculate the requisite steps for the Grover search and contrast these calculations with classical methodologies. Our analysis differs from the previous method, by considering the asymptotic behaviour of the Grover evolution. This allows us to introduce the tools for analysing differential equations, so that performance of the Grover search on unstructured database can be well assessed. Through detailed analysis, we pinpoint the specific conditions conducive to acceleration through Grover’s algorithm. To illustrate our discoveries, we showcase two compelling examples. The first example validates our theoretical framework by aligning closely with Grover’s seminal outcomes. In the second example, we demonstrate how implementing Grover’s search on a database governed by a probability distribution resembling a coherent state yields significant speed enhancements compared to traditional methods. Meanwhile, we specify that the approximation strategy are effective in the samples, by comparing the results with the explicit solutions of the difference Eq. (6). These results represent a significant advancement of analysing Grover algorithm, enriching its implementation strategies and broadening its scope of potential applications.
Acknowledgements
This work was funded by MCIN/AEI /10.13039/501100011033 (No. PID2021-126273NB-I00), by “ERDF A way of making Europe”, and by the Basque Government through Grant No. IT1470-22. We also acknowledge the support by National Natural Science Foundation of China (No.11904022). This project has also received support from the Spanish Ministry for Digital Transformation and of Civil Service of the Spanish Government through the QUANTUM ENIA project call - Quantum Spain, EU through the Recovery, Transformation and Resilience Plan-NextGenerationEU within the framework of the Digital Spain 2026.
Author contributions
The idea is initialized by L.-A.W. The theoretical derivation is performed by Y.S. All authors reviewed the manuscript.
Data availibility
The datasets used and/or analysed during the current study available from the corresponding author on reasonable request.
Footnotes
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Contributor Information
Yifan Sun, Email: yfsun@bit.edu.cn.
Lian-Ao Wu, Email: lianao.wu@ehu.es.
References
- 1.Grover, L. K. Quantum mechanics helps in searching for a needle in a haystack. Phys. Rev. Lett.79, 325 (1997). [Google Scholar]
- 2.Feynman, R. P. Simulating physics with computers. Int. J. Theor. Phys.21, 467 (1982). [Google Scholar]
- 3.Karp, R. M. Reducibility Among Combinatorial Problems, in Complexity of Computer Computations 85–103 (Springer, Berlin, 1972). [Google Scholar]
- 4.Wiebe, N., Kapoor, A., & Svore, K. Quantum perceptron models. arXiv:1602.04799.
- 5.Gilliam, A., Woerner, S. & Gonciulea, C. Grover adaptive search for constrained polynomial binary optimization. Quantum5, 428 (2021). [Google Scholar]
- 6.Brassard, G., Hoyer, P., Mosca, M. & Tapp, A. Quantum amplitude amplification and estimation. AMS Contemp. Math.305, 53 (2002). [Google Scholar]
- 7.Ren, F.-H., Wang, Z.-M. & Wu, L.-A. Accelerated adiabatic quantum search algorithm via pulse control in a non-Markovian environment. Phys. Rev. A102, 062603 (2020). [Google Scholar]
- 8.Wu, L.-A., Byrd, M. S. & Lidar, D. A. Polynomial-time simulation of pairing models on a quantum computer. Phys. Rev. Lett.89, 057904 (2002). [DOI] [PubMed] [Google Scholar]
- 9.Pyshkin, P. V., Luo, D.-W., Jing, J., You, J. Q. & Wu, L.-A. Expedited holonomic quantum computation via net zero-energy-cost control in decoherence-free subspace. Sci. Rep.6, 37781 (2016). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 10.Sun, Y., Zhang, J.-Y., Byrd, M. S. & Wu, L.-A. Trotterized adiabatic quantum simulation and its application to a simple all-optical system. New J. Phys.22, 053012 (2020). [Google Scholar]
- 11.Tezuka, H., Nakaji, K., Satoh, T. & Yamamoto, N. Grover search revisited: Application to image pattern matching. Phys. Rev. A105, 032440 (2022). [Google Scholar]
- 12.Reitzner, D. & Hillery, M. Grover search under localized dephasing. Phys. Rev. A99, 012339 (2019). [Google Scholar]
- 13.Brickman, K.-A. et al. Implementation of Grover’s quantum search algorithm in a scalable system. Phys. Rev. A72, 050306(R) (2005). [Google Scholar]
- 14.Figgatt, C. et al. Complete 3-qubit Grover search on a programmable quantum computer. Nat. Commun.8, 1918 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 15.Vemula, D. R., Konar, D., Satheesan, D., Kalidasu, S. M., & Cangi, A. A scalable 5,6-qubit Grover’s quantum search algorithm. arXiv: 2205.00117.
- 16.Gustiani, C. & DiVincenzo, D. P. Blind three-qubit exact Grover search on a nitrogen-vacancy-center platform. Phys. Rev. A104, 062422 (2021). [Google Scholar]
- 17.Pan, N., Chen, T., Sun, H. & Zhang, X. Electric-circuit realization of fast quantum search. Research2021, 9793071 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 18.Ji, T., Pan, N., Chen, T. & Zhang, X. Fast quantum search of multiple vertices based on electric circuits. Quantum Inf. Proc.21, 172 (2022). [Google Scholar]
- 19.Ji, T., Pan, N., Chen, T. & Zhang, X. Quantum search of many vertices on the joined complete graph. Chin. Phys. B.31, 070504 (2022). [Google Scholar]
- 20.Biham, E., Biham, O., Biron, D., Grass, M. & Lidar, D. A. Grover’s quantum search algorithm for an arbitrary initial amplitude distribution. Phys. Rev. A60, 2742 (1999). [Google Scholar]
- 21.Biham, E. et al. Analysis of generalized Grover quantum search algorithms using recursion equations. Phys. Rev. A63, 012310 (2000). [Google Scholar]
- 22.Nielsen, M. A. & Chuang, I. L. Quantum Computation and Quantum Information (Cambridge University Press, Cambridge, 2000). [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Data Availability Statement
The datasets used and/or analysed during the current study available from the corresponding author on reasonable request.