Quantum Search Algorithm

Search algorithms aim to find solutions or objects with specified properties and constraints in a large solution search space or among a collection of objects. A solution can be a set of value assignments to variables that will satisfy the constraints or a sub-structure of a given discrete structure. In addition, there are search algorithms, mostly probabilistic, that are designed for the prospective quantum computer. This book demonstrates the wide applicability of search algorithms for the purpose of developing useful and practical solutions to problems that arise in a variety of problem domains. Although it is targeted to a wide group of readers: researchers, graduate students, and practitioners, it does not offer an exhaustive coverage of search algorithms and applications. The chapters are organized into three parts: Population-based and quantum search algorithms, Search algorithms for image and video processing, and Search algorithms for engineering applications.


Introduction
For a search problem associated with a unsorted database, the remarkable Grover's quantum algorithm (1) provides a quadratic speedup over its classical counterpart. The search problem can be described as follows: for a given function f , there exists one unknown element in the set {0, 1, ..., N − 1} that satisfies f (x)=−1, say x = τ, whereas the other N − 1o n e sg i v e f (x)=1. How many times of evaluations of f are required to determine the element τ for f (τ)=−1? Through a conventional algorithm, one needs O(N) trials to achieve this aim. How about the utility of quantum algorithm for the search? For the scenario in the quantum world, the search problem can be rephrased in the quantum mechanical language: for a given unitary operator I τ , that is sometimes called the oracle operator, and a set of state vectors (orthonormal basis): s = {|0 , |1 , ..., |N − 1 }, I τ |x = |x for all states in the set except I τ |x = − |x for x = τ.H owma n yqueriesofI τ are required to determine |τ ? By Grover's algorithm, one needs only O( √ N) quantum mechanical steps to find the marked state |τ out. It has been shown that Grover's algorithm is optimal since it needs minimal oracle calls to perform a quantum search (2). The quantum searching process will be briefly reviewed as follows. The first step of Grover's algorithm is to prepare a superposition state of all elements with uniform probability amplitude: Then apply the Grover kernel G = −I η I τ to |s ,w h er eI η is a unitary operator and contains no bias against the marked state. For large N,a f t e ra b o u tm = π √ N/4 repetitions of G operations, the probability to observe |τ is close to one, i.e.,
where the angle Ω is defined by The matching condition (19), or (20), relates the angles φ, θ, β, β 0 ,a n dα + u for finding a marked state with certainty. If β, β 0 and α + u are designated, then φ = φ(θ) is deduced by the matching condition. As φ(θ) is determined, we then can evaluate the value of f = f (φ(θ), θ) by (23) and consequently decide the number of iterations m by (22). It is worth to note that as α + u = 0andβ = β 0 , the matching condition recovers φ = θ automatically since then Eq. (20) becomes an identity, and accordingly one has which is the case discussed in Ref. (5). We also note that the matching condition (19) will recover the relation by Høyer (6): Observing Figs. 1 and 2, one realizes that for every designation of β, β 0 and α + u,theoptimal choices for φ and θ is φ = θ = π, since then the corresponding f is minimum under the fact df/dθ =( ∂ f /∂φ)(dφ/dθ)+∂ f /∂θ = 0, for φ = θ = π. We thus denote the optimal value of m by With the choice of m op , however, one needs to modify the phases θ and φ(θ) to depart from π so that the matching condition is satisfied again. For example, if α + u = 0, β 0 = 10 −4 and β = 0.7 are designated, then the minimum value of f will be min( f )=0.56 . So we choose m op = 1 and the modified phases are θ op =(1 ± 0.490)π and φ op =(1 ± 0.889)π, respectively. This example has been shown by the marked black circles in Fig. 1. It is worth to note again that under the choice of m op the modified φ and θ for the special case considered by Long (5) will be where This is in fact a special case in which the phases φ op and θ op can be given by a closed-form formula.

Phase error tolerance in a quantum search algorithm
In Section 3 we have given a general review of quantum search algorithm with SU (2) formulation. To give a detailed discussion about phase error tolerance in a quantum search algorithm, in what follows we will focus on the original version of Grover's algorithm, which means that the unitary operator U shown in Eq. (4) corresponds to a specific transformation. Grover's quantum search algorithm (1) is achieved by applying Grover kernel G on an uniform superposition state (1), which is obtained by applying Walsh-Hadamard transformation on a initial state, in a specific operating step such that the probability amplitude of marked state is amplified to a desired one. Specifically, Grover's kernel is composed of phase rotations and Walsh-Hadamard transformations. The phase rotations include two kinds of operations: π-inversion of the marked state and π-inversion of the initial state. As shown in Section 3, the phases, π, can be replaced by two angles, φ and θ,u n d e r the phase matching criterion, which is the necessary condition for quantum searching with certainty. In other words, the relation between φ and θ will affect the degree of success of quantum search algorithm.
There have been several studies concern with the effect of imperfect phase rotations. Long et al. (7) have found that, a given expected degree of success P max , the tolerated angle difference between two phase rotations, δ, due to systematic errors in phase inversions is about 2/ √ NP max ,whereN is the size of the database. Høyer (6) has shown that after some number of iterations of Grover kernel, depending on N and unperturbed θ, it will give a solution with The same result is also redrived by Biham et al. (8). A roughly close conclusion, δO(1/N 2/3 ),ispresentedby Pablo-Norman and Ruiz-Altaba (9). The result of Long et al. (7) is based on the approximate Grover kernel and the assumptions of large N and small δ. However, one can find that the main inaccurancy comes from the approximate Grover kernel. Since all parameters in Grover kernel connect with each other exquisitely, any reduction to the structure of Grover's kernel would destroy this penetrative relation, so accumulative errors emerge from the iterations to a quantum search. In what follows, we will use the tool derived from SU(2) formulation discussed in Section 3 to get an improved criterion for tolerated error in phase rotation and the required number of qubits for preparing a database (10). In addition, a concise formula for evaluating minimum number of iterations to achieve a maximum probability will also be acquired. Let us follow the derivation detailed in Section 3 for the analysis of error tolerance. If the operator U is Walsh-Hadamard transformation W, the orthonormal set becomes where W τη = τ| W |η and l =(1 − W τη 2 ) 1/2 .SinceW τη = sin(β) we have and the Grover kernel can now be written as (1 +(e iθ − 1) sin 2 (β)) (e iθ − 1) sin(β) cos(β) e iφ (e iθ − 1) sin(β) cos(β) 1 +(e iθ − 1) cos 2 (β) .
After m number of iterations, the operator G m can be expressed as Then the probability of finding a marked state is By the equation ∂P/∂(cos(mw)) = 0, the minimum number of iterations for obtaining the maximum probability, P max (cos(m min w)),isevaluated: where Variations of exact vaule of P max (n)(cross marks), 16β 2 sin 2 ( θ 2 )/(δ 2 + 16β 2 sin 2 ( θ 2 )) (solid), and 4β 2 /(δ 2 + 4β 2 ) (dash) for θ = π, δ = 0.01 where β = sin −1 (2 −n/2 ). For a sure-success search problem, the phase condition, φ = θ,w i t hm min =( π/2 − sin −1 (sin(φ/2) sin(β))/w, is required. However, when effects of imperfect phase inversions are considered, the search is not certain, then the new condition to phase error, δ = φ − θ, and the size of database should be derived in order to accomplish the search with a reduced maximum probability. Now, we suppose the database is large, i.e., if sin(β) ≪ 1, and a phase error δ is small, where |δ| ≪ 1, one has the following approximation: The probability P (Eq.35) then can be expressed approximately as with a maximum value, by setting sin 2 (mw)=1, is an underestimation depicted by dash lines.

Family of sure-success quantum search algorithms
Even in the case of large N, where high success rate in finding the marked state is expected by using the standard Grover's algorithm, inevitable noises including decoherence and gate inaccuracies can significantly affect the efficiency of the algorithm. To overcome such drawback , one might either apply the fault-tolerant computation (11) to reduce gate imperfections and decoherence, or limit the size of the quantum database to depress the effect of the uncertainty of the phase inversion operations. In another way, one can also, if possible, consider implementing a modified algorithm which is itself robust against phase imperfections and or decoherence. Recently, Hu (12) introduced an interesting family of algorithms for the quantum search. Although these algorithms are more complicated than the standard Grover's algorithm, they can be proved to be robust against imperfect phase inversions, so the limitation of the size of database can be greatly relieved. In what follows the algorithms introduced by Hu (12) will be analyzed intently in detail, and the robustness of the family in resisting the effect of imperfect phase inversions will be shown later on. Let us denote the phase inversion of marked state I τ = 1 +(e iφ − 1) |τ τ| as usual and the phase inversion of the initial state I s = 1 +(e iθ − 1) |s s|. Instead of applying G n on the initial state |s , Hu (12) presented and utilized the operators A 2n =(I † s I † τ I s I τ ) n and A 2n+1 = GA 2n to accomplish a quantum search with certainty, and named the former the even member and the latter the odd member of the family {A n , n = 1, 2, ...} because they require even (2n)andodd (2n + 1) oracle calls in computation, respectively. The arrangement I † s I † τ I s I τ is shown to have cancellation effect on phase errors in each iteration of the algorithm A 2n and A 2n+1 and as a whole can ensure the robustness against imperfect phase inversion. Consider a two-dimensional Hilbert space spanned by the marked state |τ and the state |τ ⊥ , which is orthogonal to |τ . The initial state, as a uniform superposition of all states, then can be expressed by |s = W |0 = sin(β) |τ + cos(β) |τ ⊥ ,w h e r es i n (β) ≡ √ M/N and M is the number of the target states. The eigenvalues of the operator I † s I † τ I s I τ are λ 1,2 = cos(ω) ± i sin(ω) and the corresponding eigenvectors are computed (13; 14) as where the rotation x and the related parameters are defined by Then in n iterations of the operator of I † s I † τ I s I τ we will have A 2n =(I † s I † τ I s I τ ) n = λ n 1 |λ 1 λ 1 | + λ n 2 |λ 2 λ 2 |, which can be expressed in the following matrix form: where sin(2x) and cos(2x) are given by When the quantum search is carried out by using the even member A 2n , the component of the final state after n iterations of (I † s I † τ I s I τ ) in the basis state |τ ⊥ is expressed by τ ⊥ | A 2n |s = RE e + iIM e , and accordingly the exact success rate in finding the marked state |τ then is given by where It is clear that when IM e = 0, one obtains the n-independent phase matching condition, φ = −θ,forA 2n , and the success rate then becomes where α = sin −1 (sin(β) cos(φ/2 + γ)). The 100% success rate for the search problem can be achieved as by setting cos(nω − α)=0. For a search with certainty, since n is a positive integer, one therefore has to expect the iteration number given by and the function f e (θ, β) is given by Given β, the function f e has its minimal value as θ = π (and φ = −π thereby), as if minimal oracle calls are demanded in the computation, we should have the optimal phase θ op associated with For example, if given β = 1, we have ⌈ f e (π,1)⌉ = 1, and the optimal phase angle θ op = π ± 1.304 follows in the algorithm using the even member A 2n . In usual operation, however, the quantum database is large, i.e., sin(β) ≪ 1, and the phase θ = π and φ = −π are fixed, then the required iterations are estimated by n ∼ π/8β and the maximal success rate will be approximately evaluated which is the same result obtained as if the standard Grover algorithm is implemented. That is, as the phase θ = π is fixed, the present algorithm (A 2n ) is equivalent to the standard algorithm (G m ) with even oracle calls required in the computation. Nevertheless, since in a real operation, imperfections in the phase inversions are inevitable. In what follows,one can show that the present algorithm is robust against small phase imperfections in a quantum computation and provides a maximal success rate that is similar to the one given above.
In the absence of decoherence and error correction, constant phase errors are considered to cause the phase φ and θ to be φ = π + φ e and θ = π + θ e ,w h e r e|φ e | ≪ 1a n d|θ e | ≪ 1. By introducing the constant phase imperfections, one then has the following approximations, when β ≪ 1, Then, since the errors are unknown in advance of the computation, the iteration number is also considered to be n ∼ π/8β, and one thus has cos(nω) ∼ π(θ 2 e + φ 2 e )/16 − 2πβ 2 /3 and sin(nω) ∼ 1. The approximation of RE e and IM e accordingly are evaluated by The maximal success rate now is approximately derived by where H.O.T. represents high order terms higher than second-degree in the small parameters β, θ e and φ e . Expression (55) clearly shows that the reduction of the probability due to the introduction of the phase errors in fact can almost be neglected. Then, through it, we can see that the present algorithm is robust against systematic phase imperfections. We proceed to analyze the algorithm using the odd member A 2n+1 by the same procedure as in analyzing the even member. In this case, one obtains where ).
For IM o = 0, one has the phase matching condition, φ = θ,f o rA 2n+1 . The 100% success rate then can be ensured when the iteration steps at Note that in this case the inequality 1 − 4sin(θ/2) 2 ≥ 0 should be demanded since then the meaningful requirement f o ≥ 0 can then be fulfilled. Given β, the function f o (θ, β) also has its minimal value at θ = π (then φ = π), as the optimal choice of the phase θ op should be estimated by when minimal oracle calls are demanded in a search with certainty. For β = 1, the choice of the phase should be θ op = φ op = π ± 1.870, for example. The standard Grover algorithm with odd oracle calls can be recovered when θ = φ = π is fixed. In usual operations, when phase imperfections are introduced, i.e., as θ = π + θ o and φ = π + φ o ,w h e r eb o t hθ o and φ o are small errors in the phases, they also produce almost negligible reductions in the success rate as given by an expression like Eq. (55).

Analog quantum search
Several researchers have proposed other ways to solve the quantum search problem, such as the analog analogue version of the Grover's algorithm (15)(16)(17) and the adiabatic evolution to quantum search (18)(19)(20). The former is to be considered here. It is proposed that the quantum search computation can be accomplished by controlled Hamiltonian time evolution of a system, obeying the Schrödinger equation where the constanth = 1 is imposed for convenience. Farhi and Gutmann (15) where φ is an additional phase to the Fenner Hamiltonian. Unlike the Grover algorithm, which operates on a state in discrete time, a quantum search Hamiltonian leads to the evolution of a state in continuous time, so the 100% probability for finding the marked state can be guaranteed in the absence of all kinds of imperfection occurring in a quantum operation. Both the Hamiltonian H fg and H f can help to find the marked state with 100% success. However, Bae and Kwon (17) addressed that the generalized Hamiltonian H g can accomplish the search with certainty only when φ = nπ is imposed, where n is arbitrary integer. In what follows, one can show that the generalized Hamiltonian H g can be derived by an analytical method, which is distinct to the one implemented by Bae and Kwon (17), and the same method will lead to arbitrary chosen phase φ, depending on when the measurement on the system is undertaken and how large the system energy gap is provided. Since Hamiltonian-controlled system is considered, the energy-time relation will play an essential role in the problem. Therefore, the evaluation of the measuring time for the quantum search becomes crucially important. Here, the general Hamiltonian for the time-controlled quantum search system will be reviewed first. The exact time for measuring the marked state will be deduced. Finally, the role played by the phase φ in the quantum search will be discussed, and both the measuring time and the system energy gap as variations with φ will be given.
Suppose that a two-dimensional, complex Hilbert space is spanned by the orthonormal set |w , which is the marked state, and |w ⊥ , which denotes the unmarked one. An initial state |s = |Ψ(0) , which corresponds to the quantum database discussed in the previous sections, is designed to evolve under a time-independent quantum search Hamiltonian given by (21) where E 1 and E 2 are two eigenenergies of the quantum system, E 1 > E 2 ,and|E 1 and |E 2 are the corresponding eigenstates satisfying the completeness condition The eigenstates can be assumed by where x and α are two parameters to be determined later based on the required maximal probability for measuring the marked state. Then the Hamiltonian can be written in the matrix form where E p =( E 1 + E 2 )/2 is the mean of eigenenergies and E o =( E 1 − E 2 )/2 represents half of the system energy gap. The major advantage of using the controlled Hamiltonian time evolution is that the marked state can always be searched with certainty in the absence of quantum imperfections. The crucial key of the present problem in turn is to decide when to measure the marked state by the probability of unity. So in what follows the relation between all the unknowns appearing in the system will be deduced in detail and the exact measuring time for finding the marked state with certainty will be evaluated later on. The time evolution of the initial state is given by |Ψ(t) = e −iHt |s . Therefore, the probability of finding the marked state will be P = w| e −iHt |s Without loss of generality, let us consider the problem of searching one target from N unsorted items. The general form of the initial state considered in this study is given by where sin(β) ≡ 1/ √ N and u denotes the relative phase between the two components in the initial state. Note that the relative phase u may arise from a phase decoherence or an intended design during the preparation of the initial state. Now, because of To accomplish the quantum search with maximal probability, the time-independent term (cos(2x) cos(β) − cos(α − u) sin(2x) sin(β)) must be vanished and thus the unknown x can be determined by cos(2x)= sin(β) cos(α − u) cos(γ) ,or sin(2x)= cos(β) cos(γ) , where γ is defined by sin(γ)=sin(β) sin(α − u) . The probability for finding the marked state then becomes If the size of database N is large, then γ ≪ 1 and the marked state |w will be measured at t = π/(2E o ) by a probability p = 1 − tan 2 γ ∼ 1, according to (68). Expression (68) also indicates that, by setting cos 2 (E 0 t + γ)=0, one can measure the marked state with unit probability, no matter how large N is, at the time instants In what follows, let us only focus on the first instant It is clear that a larger E o , or equivalently a larger system energy gap, will lead to a shorter time for measuring the marked state with certainty. Meanwhile, as can be seen in (68), the probability for measuring the marked state varies with time as a periodic function whose frequency is the Bohr frequency E o /π,s oal a r g e rE o will also result in a more difficult control on the measuring time. In other words, the measuring time should be controlled more precisely for a higher Bohr frequency in the state evolution since then a small error in the measuring time will cost a serious drop of the probability. However, the energy gap E o depends on the size of database N, as will be mentioned later.
With the relations sin(2x) and cos(2x),thepresentHamiltoniannowcanbewrittenby which is represented in terms of the energies E p and E o and the phase α. Alternatively, if we let or inversely, then the Hamiltonian can also be expressed by which in turn is represented in terms of the energies E fg and E f and the phase φ.T h e Hamiltonian shown in (73) in fact can be expressed as H g = E fg (|w w| + |s s|)+ E f (e iφ |w s| + e −iφ |s w|), which is exactly of the same form as the Bae and Kwon Hamiltonian H g shown in (61). However, Bae and Kwon (17) only consider the case u = 0 . In both the presentations (70) and (73) of the Hamiltonian H, the corresponding measuring time for finding the marked state |w with certainty is at Equation (74)  To discuss further, one first considers the case u = 0, i.e., the case where neither phase decoherence nor intended relative phase is introduced in the preparation of the initial state |s .Ifφ = nπ,orα = nπ,isimposed,thenthe present Hamiltonian reduces to that considered by Bae and Kwon (17) to serve for a search with certainty when the measurement is undertaken at and α = 0, is imposed, then the present Hamiltonian reduces to the Farhi and Gutmann Hamiltonian H fg , which serves for a search with certainty at t 1 = π/(2E o )=π/(2E fg sin β).F u r t h e r ,w h e nE fg = 0a n dφ = π/2, or E p = 0andα = π/2 is chosen, the present Hamiltonian will reduce to the Fenner Hamiltonian H f associated with the measuring time t 1 =( π − 2β)/(2E o )=( π − 2β)/(2E f cos β).I n general, the phase φ,o rα, in fact can be imposed arbitrary for a search with certainty as the condition u = 0isimposed. However, if inevitable phase decoherence in the preparation of the initial state |s is considered, then the phase u must be assumed to be arbitrary. Accordingly, the probability for finding the marked state will not be unity at all. For example, if following the treatment of Bae and Kwon (17) by setting t 1 = π/(2E o ), then we only have a probability for finding the marked state given by It is easy to show that the probability shown in (75) is always greater than or equal to the lower bound p min = 1 − sin 2 (β)=1 − 1/N. Of course, if the nonzero phase u is introduced by an intended design, not an inevitable phase decoherence, then a search with certainty can be accomplished for an arbitrary φ,orα, when associated with the measuring time shown in (74). For example, if u = π/2 is the phase designated, the ideal measuring time should be t 1 =( π − 2β)/(2E o ), which is the same as the Fenner's t 1 . Again if the phase decoherence is introduced into the system and changes the phase from π/2 to an undesired u, then one eventually obtains a poor probability p = 1 − (1 + sin 2 (u) − 2sin(u)) sin 2 (β).Moreoverifthe phase error occurs randomly in a quantum database, then one is unable to be sure when to take a measurement, and the probability for finding the marked state even drops off seriously in some cases. A brief review on the comparison between E fg and E f , which has been discussed in Ref. (22), can be given now and the implication behind the analog quantum search first presented by Farhi and Gutmann (18) will be recalled. Suppose there is a (N − 1)-fold degeneracy in a quantum system and its Hamiltonian is read as H 0 = E |w w|, then our assignment is to find the unknown state |w . Since one does not yet know what |w is, it is natural to add a well known Hamiltonian, H D = E |s s|, such that the initial state of the system |s can be drove into |w . The total Hamiltonian therefore becomes H = H 0 + H D = E(|w w| + |s s|),which is just the Hamiltonian of Farhi and Gutmann (18) (16), then one encounters with E o ∼ E f cos(φ − u) and accordingly the measuring time t 1 is independent of the size of database N. Therefore, in an usual case the assumption E f ∼ E fg sin(β) is reasonable. An interesting phenomenon occurs when the critical condition E f = E fg sin(β) is considered. Fig. 6 shows the variations of t 1 and E o with the phase difference φ − u in such a case. It is observed that when φ − u = ±π the energy gap E o becomes zero and then the eigenstates of the quantum search system correspond to the common eigenvalue E = E 1 = E 2 and become degenerate. In such case, the Hamiltonian becomes proportional to the identity 1(= |w w| + |w ⊥ w ⊥ |). Therefore, the initial state |s does not evolve at all and the probability for finding the marked state |w indeed is the initial one, viz., p = sin 2 (β)=1/N, which can also be deduced using Eq. (68). In other words, the quantum search system is totally useless as long as φ − u = ±π is imposed under the critical condition E f = E fg sin(β).Wh enφ − u = ±π, both t 1 and E o are finite, as can be seen from Fig. 6, and therefore the quantum search system becomes efficient again and is capable of finding the marked state with certainty, especially when the phase difference is imposed around φ − u = 0. As a conclusion, for an efficient, useful quantum search system, the critical condition mentioned above should be avoided and in fact the reasonable condition E f ∼ E fg sin(β) is recommended to be imposed.

Summary
A general SU(2) formulation is introduced to investigate the quantum search algorithm. In Sections 2 and 3, we show that the matching condition (19) for finding a marked state with certainty for arbitrary unitary transformations and an initial state can be derived from the general SU(2) formulation. Furthermore, one can also benefit from the same approach to evaluate the required number of iterations for the search such as Eqs. (22) and (23). With a given degree of maximum success, in Section 4 we derive a generalized and improved criterion for the tolerated error and the corresponding size of the quantum database under the inevitable gate imperfections. In Section 5, we consider a family of sure-success quantum algorithms and prove the matching conditions for both groups and give the corresponding formulae for evaluating the iterations or oracle calls required in the search. In addition, we show this kind of algorithms is robust against small phase imperfections in quantum gate operations. In the final section, we apply the same method as used for quantum search in the quantum circuit model to the analogue quantum search. A generalized Hamiltonian driving the evolution of quantum state in the analog search system is derived. Both the measuring time and the system energy gap suitable for a quantum search with or without certainty can be evaluated with the general results. Search algorithms aim to find solutions or objects with specified properties and constraints in a large solution search space or among a collection of objects. A solution can be a set of value assignments to variables that will satisfy the constraints or a sub-structure of a given discrete structure. In addition, there are search algorithms, mostly probabilistic, that are designed for the prospective quantum computer. This book demonstrates the wide applicability of search algorithms for the purpose of developing useful and practical solutions to problems that arise in a variety of problem domains. Although it is targeted to a wide group of readers: researchers, graduate students, and practitioners, it does not offer an exhaustive coverage of search algorithms and applications. The chapters are organized into three parts: Population-based and quantum search algorithms, Search algorithms for image and video processing, and Search algorithms for engineering applications.