Robust Quantum Search with Uncertain Number of Target States

The quantum search algorithm is one of the milestones of quantum algorithms. Compared with classical algorithms, it shows quadratic speed-up when searching marked states in an unsorted database. However, the success rates of quantum search algorithms are sensitive to the number of marked states. In this paper, we study the relation between the success rate and the number of iterations in a quantum search algorithm of given λ=M/N, where M is the number of marked state and N is the number of items in the dataset. We develop a robust quantum search algorithm based on Grover–Long algorithm with some uncertainty in the number of marked states. The proposed algorithm has the same query complexity ON as the Grover’s algorithm, and shows high tolerance of the uncertainty in the ratio M/N. In particular, for a database with an uncertainty in the ratio M±MN, our algorithm will find the target states with a success rate no less than 96%.


Introduction
The quantum search algorithm is one of the most significant quantum algorithms [1]. Compared with classical search algorithms, quantum search algorithms exhibit quadratic speedup [2,3]. This demonstrates the superiority of quantum computing over classical computing. Grover proposed the first quantum search algorithm [1,4], which can find M marked items from an unstructured database with N items by querying only O( √ N/M) times [5,6]. If the measurements are made after the optimal iterations, Grover's algorithm will have a success rate P max = sin 2 [(2j op + 1)β] to find the marked items, where β = arcsin √ M/N and j op = [(π/2 − β)/(2β)] is the number of optimal Grover iterations. If (2j op + 1)β ≈ π/2, the maximum probability approaches 1, which means that the Grover's algorithm usually has a high success rate if the dimension of the quantum database is very large.
There have been several important developments in the Grover's algorithm. In some situations, such as structured search [7], where the success rate is the product of the success rates of individual search, high success rate in each individual search is critical; especially, when dimensions are not so large, the standard Grover's algorithm will not perform well. In order to solve this problem, some modified search algorithms have been proposed [8][9][10][11][12]. The Grover-Long algorithm [11], one of these improved algorithms, has been proved to be the simplest and most optimal [13,14]. This algorithm achieves 100% success rate, whereas Grover's algorithm can only achieve 100% success rate when finding one out of four.
In both the original Grover and improved versions of Grover's algorithm, one needs to know the exact number of marked states in advance. Therefore, if the exact number is not known, these algorithms can not determine when to stop [15]. Spatial search [16][17][18] is one of the methods to solve this problem. Fixed-point search algorithm is another method to solve this problem. By constructing the recursively searching operator, the ratio of marked state always amplifies after each search, the π/3 fixed-point search algorithm of Grover [19], for example. In this algorithm, each search approaches the marked states monotonously, but the cost of monotony is large in this algorithm, and the quadratic speedup of standard Grover's algorithm is lost.
The Yoder-Low-Chung algorithm [20] was proposed to improve the performance of fixed-point algorithms on wide ranges of M/N. It retains the quadratic speedup advantage of quantum search, and it achieves the fixed-point property at the same time. It also solves overcooking problem, but the success rate of which is not monotonically increasing as in the π/3 algorithm. The error is bounded by a tunable parameter δ ∈ [0, 1] over an ever-widening range of M/N, but the phases in each search step need to be calculated by solving a hype-trigonometric equation.
In this paper, we develop a robust quantum search algorithm, based on the Grover-Long algorithm, which overcomes the problem of not knowing the exact ratio M/N in advance. This algorithm has the advantage of easiness in constructing the search operators, and also certain degrees of "fixed-point" properties. Namely, it enjoys a high success rate over a wide range of the ratio of M/N. In our algorithm, we do not need to know the exact number of marked states, but rather an approximate number in the range [λ 0 , λ 0 + ∆] of the ratio λ = M/N. The error of our algorithm is bounded by a parameter δ ∈ [0, 1] related to the ∆/λ 0 . Specifically, searching operators in our algorithm are determined by the lower bound λ 0 . After J + 1 − J D iterations, the probability of success is larger than 1 − δ 2 , where J D is denoted as This paper is organized as follows. First of all, the Grover-Long algorithm is summarized. Secondly, the relationship between the success rate of Grover-Long algorithm and iterative steps is studied, and the relation between iteration number and success rate is given. Thirdly, we propose a robust search version of Grover-Long algorithm and show its high tolerance to the ratio M/N. The comparison is then made with the Yoder-Low-Chuang algorithm, standard Grover's algorithm, and the Grover π/3 fixed-point algorithm, respectively. Finally, we prove that our algorithm can find the target state with a success rate of more than 96% from an database, with only an estimate of M, in the range between {M − √ M, M + √ M}, which can be carried out using the quantum counting algorithm [21,22].

Overview of Grover-Long Algorithm
The Grover-Long algorithm can extract M marked items from an unstructured database with N items by querying O √ N/M times. First, from the given ratio M/N, parameter β can be calculated: which is further used to determine the value of search steps j op = π−2β 4β . The square brackets here represent the floor function. One can set the number of iteration as Then, the phases in the search algorithm are calculated by Next, the oracle operator can be expressed as where |τ denotes as the superposition of M marked states, and the phase shifting operator for the |0 state is Finally, the Grover-Long operator in each iteration is where H is the Hadamard gate. After J + 1 steps of iterations, one can obtain the marked states with certainty by measurement. When φ = π, we recover the original Grover's algorithm, which usually does not find the marked states with certainly. The quantum search algorithm can be described using the SO(3) picture [11,23] instead of SU (2). In this picture, the quantum search operator in Equation (6) corresponds to a rotation in three-dimensional space with the following matrix form where the entries of the matrix R Q are calculated in [11]. The states are rotated along the l axis with an angle In this picture, the state vector |ψ = (a + bi)|τ + (c + di)|τ is represented as where σ = σ x i + σ y j + σ z k and i, j, k are the unit vector along the x, y, z axis. The initial state |ψ i and the marked state |τ are represented by Each search step is a rotation of r ψ toward r f . The SO(3) description of the Grover-Long algorithm is pictured as a circle in Figure 1.

Relationship between the Success Rate and Searching Iterations
During each search step of the Grover-Long algorithm, state r ψ = OA rotates toward r f = OB, which is described geometrically in Figure 1. In other words, this process is point A moving to point B on the blue circle r 0 . In this picture, the probability of finding the marked state is (z A + 1)/2 [11], where z A is the Z component of point A. Thus, if one wants to find a marked state with a probability greater than 1 − δ 2 , point A of the segment r o A must rotate into the arc CD, where point C and point D are the intersections of the circle r o and the red error circle: x 2 + y 2 + (1 − 2δ 2 ) 2 = 1. If we can calculate the arc length CD, then we obtain a reasonable number of iterations.
For this reason, we focus on the spherical cone, which consists of the unit sphere and the red circle. It is shown in Figure 2. The segment BC in Figure 2 is a segment from point B(0, 0, 1) to point C on the red error circle. In Figure 2, OD = 1 − 2δ 2 , OC = 1, BD = 2δ 2 . The following relationship holds: The half length of arc CD is approximated to BC = 2δ. Next, we find the radius of the blue circle r o . As shown in Figure 3, point E is the middle of the segment AB.
In Figure 3, ∠AOB = π − 2β, OA = 1, and ∠Ar o E = ∠Ar o B 2 = J+1 2 α = (J+1)π 2J+3 . In AOE and AEr o : Thus, the number of iterations on the arc length BC is where denotes ceil function. Therefore, after several iterations with a number in [J + 1 − J δ , J + 1 + J δ ], the success rate in [1 − δ 2 , 1] will be achieved. We show the relationship between 1/λ and the minimum number of queries for a given success rate in Figure 4, which means that if the desired rate of success is not high, the number of queries is correspondingly reduced.

Robust Quantum Search with Uncertain Number of Targets
Now, consider the situation where the ratio M/N is not known. Our goal is to find the marked state with high success. Here, we propose a robust search version of the Grover-Long algorithm. In our algorithm, the error is bounded by a parameter δ over ∆/λ 0 . In fact, our algorithm degenerates to the original Grover-Long algorithm if ∆ = 0. We proceed our algorithm as follows. The initial state is prepared to the superposition state |s . Then, we find out the target state |T with success probability higher than 1 − δ 2 , in which the overlap s|T = √ λe iξ is nonzero (ξ is the phase difference between |s and |T ) and δ ∈ [0, 1]. We provide the oracle operator I τ which will flip the ancilla qubit if it matches the target state, that is, I τ |T |a = |T |a ⊕ 1 for a = τ and I τ |T |a = |T |a for a = τ, while |T are orthogonal to |T . Next, we prove how to extract |T by querying J + 1 − J D times with the successful probability higher than 1 − δ 2 . This algorithm is shown as follows.
Suppose there is a database without exact λ but, rather, its upper and lower bounds are denoted as λ 0 ≤ λ ≤ λ 0 + ∆. If we plug the lower bound λ 0 as the "overlap" into the Grover-Long algorithm, we will obtain then which obeys Equation (2), that J ≥ j op . Thus, J + 1 can be chosen as the number of iterations in Grover-Long algorithm, but when plugging J and β 0 into Equation (3), we will not obtain the right matching phase. Thus, we will not obtain the right rotation angle α in Equation (9) for each iteration along the axis l in Equation (10). Instead, we will obtain The angle difference dα between α 0 and α is The total rotation angle difference is The angle Dα is the overcooked angle ∠CoB or arc CB, shown in Figure 2. We define this overcook as 2δ: We then reduce the number of iterations in order to improve the success rate. The relation between the number of iterations and the error is given by Equation (17). Thus, the reduced number of iterations is which drives the final state into the interval of arc C B instead of CB, so the success rate of the final search is greater than 1 − δ 2 . The flowchart of our Algorithm 1 is listed as follows: Compared with other algorithms, our algorithm maintains quadratic speedup. As shown in Figure 5, our algorithm and Yoder-Low-Chuang algorithm have the same query complexity O √ 1/λ as the standard Grover's algorithm. Under the condition of output success rate greater than 1 − δ 2 = 0.96, our algorithm makes eight queries while the Yoder-Low-Chuang algorithm makes 10 queries and the π/3-algorithm makes 160 queries for 1/λ 0 = 100. For 1/λ 0 = 4000, our algorithm makes 46 queries while the Yoder-Low-Chuang algorithm makes 64 queries and the π/3-algorithm makes 6437 queries. For 1/λ 0 = 10,000, our algorithm makes 72 queries while the Yoder-Low-Chuang algorithm makes 100 queries and the π/3-algorithm makes 16,094 queries. Both our algorithm and the Yoder-Low-Chuang algorithm have the same query complexity O √ 1/λ as the standard Grover's algorithm, while the query complexity of π/3-algorithm is scaled as 1/λ.

Algorithm 1
Robust quantum search with uncertain number of targets. for a given database, just know the lower bound λ 0 and upper bound λ 0 + ∆ of λ = M/N, Obtain the search operator: Implement the search operator Q on the initial state |ψ i for J + 1 − J D times. 8.
Make measurement of the final state and one will find out the marked state with the probability greater than 1 − δ 2 .

Discussions
In our algorithm, the infimum bound of the success rate is described by Equation (24). The infimum bound of the success rate is related to ∆/λ 0 . In Figure 6, we show the relationship between the lower success rate and the overlap rate at different uncertainty ∆. When the uncertainty is zero, 100% success rate will be achieved every time, and our algorithm degrades to the standard Grover-Long algorithm. The curve increases sharply with the increase of λ, and the success rate is above 80% when the uncertainty is double λ. When the uncertainty is the same order as λ, one can still achieve a high success rate, as high as 95%.
Therefore, our algorithm has a high tolerance to the uncertainty of the ratio λ = M/N. In order to see the performance of the robustness of our algorithm clearly, especially when the overlap λ is small, we provide Figure 7, which shows the relationship between probability and 1/λ. By taking 1/λ 0 to infinity, one can see that when ∆ equals zero, our algorithm degrades to the original Grover-Long algorithm. For ∆ equals to 0.8λ 0 , the success rate of our algorithm exceeds 97%, and our algorithm has a success rate of more than 90% when ∆ equals 1.6λ 0 , and a 78% success rate when ∆ equals 2.4λ 0 . Even if ∆ equals 3.2λ 0 , our algorithm still has success rates above 60%.  Figure 6. The horizontal coordinate of the figure is the proportion λ, and the ordinate is infimum bound of the probability of success. In the figure, we use different colors to mark different deviations of ∆. One can see that when the deviation is zero, the success rate is 100% each time, which corresponds to the standard Grover-Long algorithm. For the same proportion λ, the smaller the deviation, the higher the success rate.  Figure 7. This figure shows that our algorithm has the robustness for the uncertainty of λ through the relationship between the deviation and the infimum bound of the optimal success rate, where horizontal axis is 1/λ and vertical axis is success rate, with different color curves representing different deviations.
In the worst-case scenario, one knows nothing about the rate M/N. Then, one has to run the quantum counting algorithm to estimate M, which will have an uncertainty √ M. Our algorithm works well in this case, with a success rate above 96% and keeping the total O √ N query complexity as in Grover's algorithms. After running the quantum counting algorithm, one obtains the ratio with uncertainty, that is M ± √ M /N. Thus, Plugging this value into Equation (24), the result shows that the success rate of this algorithm is higher than 96%.
Our algorithm can be used as a subroutine in any case where amplitude amplification [8] or Grover search are used [24][25][26][27] .
In summary, we propose a robust quantum search algorithm with both the advantage of simple search operators, and high success rate over a wide range of M/N values. Therefore, it provides many potential applications [28][29][30][31][32] in future quantum computing.
Author Contributions: Y.Z. formulated the theory and performed the calculation; Z.W. performed the calculation. All work was carried out under the supervision of S.W. All authors contributed to writing the manuscript. B.Y. was responsible for revising and proofreading articles. All authors have read and agreed to the published version of the manuscript.