Quick viewing(Text Mode)

Search an Unsorted Database with Quantum Mechanics

Search an Unsorted Database with Quantum Mechanics

http://www.paper.edu.cn

Front. Comput. Sci. China 2007, 1(3): 247−271 DOI 10.1007/s11704-007-0026-z REVIEW ARTICLE

Search an unsorted with

LONG Guilu ( ), LIU Yang

Key Laboratory for Atomic and Molecular Nanosciences of Ministry of Eduation, Department of , Tsinghua University, Beijing 100084, China Tsinghua National Laboratory for Science and Technology, Tsinghua University, Beijing 100084, China

© Higher Education Press and Springer-Verlag 2007

Abstract In this article, we review quantum search algo- markably, there is a quantum search which en- rithms for unsorted database search problem. Unsorted da- ables this search problem to be speeded up substantially, tabase search is a very important problem in science and requiring only ON() operations. Moreover, the quan- technology. In a quantum , a marked state can be tum is general in the sense that they can found with very high using the Grover's algo- be applied far beyond the route-finding example just de- rithm, or exactly with the Long algorithm. We review the scribed to speed up many (though not all) classical algo- Grover algorithm and related generalizations. In particular, rithms that use search heuristics. It plays very important we review the phase matching conditions in quantum roles in the fields of information and . For search algorithm. Several issues that may cause confusion example, finding the owner of a phone number, deciphering about the quantum search algorithm are also clarified. DES like code [1], solving the Simon problem [2], quantum counting problem [3]. Spaces can be efficiently searched by Keywords quantum search algorithm, Grover algorithm, a quantum robot using quantum search algorithm [4]. It can Long algorithm, Phase matching, quantum amplitude am- also speed up in a square-root manner difficult problems plification, duality computer such as the hidden shift problem [5], the Hamiltonian cir- cuit problem [6] and NP-complete problem in general [7].

1 Introduction In this review article, we will describe various aspects of quantum search . In Section 2, we give a brief in- Finding a marked item from an unsorted database (UDB), troduction of the Grover search algorithm. In Section 3, before the so-called unsorted database search (UDS) problem is a going to several important generalizations, we give a clear very common and difficult problem. Many scientific prob- separation of the basic elements in a quantum searching algo- lems can be reduced to UDS problem and the UDS has rithm. We divide the quantum searching problem into two wide applications in science and technology. For instance, basic elements: the search engine and the database. The ob- suppose you are given a map containing many cities, and scurity between a quantum search engine and a quantum da- want to find the shortest route passing through all cities on tabase often misleads people to err. Most impor- the map. A simple algorithm to find this route is to search tantly, the unitary operators U' in ||0ψ0 〉=U' 〉, the database, all possible routes through the cities and keep a record of −1 and U in the search engine G = −UR U Rτ is which route has the shortest length. On a classical computer, 0 not the same in general. However these two are often the same if there are N possible routes, it is obvious that O(N) opera- in many quantum search algorithms. Separating them clears tions are required to determine the shortest route. Re- many misunderstanding. In Section 4 we describe several generalizations of the Grover algorithm, including finding Received July 20, 2007 multiple marked items, replacing the Walsh-Hadamard trans-

E-mail: [email protected] formation with an arbitrary unitary transformation, namely the

转载 中国科技论文在线 http://www.paper.edu.cn

248 quantum amplitude amplification. In Section 5, we concen- trate on one important generalization of replacing the two phase inversions with general phase rotations. Contrary to Excellent work have been done for classical algorithms on anticipation, arbitrary phase rotations are not allowed in a searching problem [8, 9]. Grover algorithm and Shor al- good quantum search algorithm. A good quantum search al- gorithm are the two most successful algorithms in quantum gorithm can find the marked state with high probability. It [10, 11]. Grover proposed a quantum mechani- is only when the two phase rotation angles satisfy a phase cal search algorithm [12] which is polynomially faster than matching condition that a good quantum search algorithm classical algorithm. The investigated problem is: there is can be built. It depends both on the quantum search engine an unsorted database containing N items of which only one and on the quantum database. In Section 6, we review an item is to be retrieved. This is the UDS problem. exact quantum search algorithm, the Long algorithm. The The classical algorithm for this problem is to examine standard Grover algorithm finds a marked state with very items one by one. Thus the algorithm needs N/2 iterations high probability in general for very large database. How- in average for finding a desired marked item. Quantum me- ever in some applications, the quantum database size is lim- chanics systems can be in a superposition of the basis states. ited, or the number of marked states is large, then Grover By properly adjusting the various operations, Grover search algorithm runs into difficulty. For instance, Grover algo- algorithm enables√ this method to speed up substantially, re- rithm fails for a database with only two items or half of the quiring only O( N) operations. data is the marked states. The application of the Grover al- Now we examine the Grover algorithm. Let a quantum n gorithm does not increase the finding probability at all. In system have N =2 states which are labelled as |i(i = this case, the Long algorithm is very suited for. It involves 1, 2,...,N), there is a unique marked state |τ that satisfies replacing the two phase inversions with two phase angles a query function C(i)=1, whereas any other state satis- satisfying the phase matching condition and dependent on fies function C(i)=0. The search problem is to identify the size of the database. An analytic expression is explicitly the state τ. To fulfill Grover algorithm, two types of ele- given for the angles. In Section 7, we review the other im- mentary unitary operations are required in the processing: portant generalization of the Grover algorithm, the quantum 1) the Walsh-Hadamard transformation [13], denoted as W ; amplitude amplification (QAA). Standard Grover algorithm 2) selective inversions of the phase of states. The strategy of uses evenly distributed database. In QAA, the items in the the Grover algorithm is to begin with an evenly distributed database may have different coefficients. In Section 8, we state to perform successive above-mentioned operations so briefly review the newly proposed duality computer and the as to increase sufficiently large probability of obtaining the quantum search algorithm in it. A duality computer exploits marked state. both the particle and wave nature of quantum systems. In The W operator performed on single is represented by the addition to quantum parallelism, it also possesses the duality ⎡ ⎤ parallelism. The duality search algorithm provides a way of 1 ⎢ 11⎥ running classical search algorithms in a quantum computer. H = √ ⎣ ⎦ . (1) In Section 9, we give a brief analysis of misunderstanding 2 1 −1 about the quantum search algorithm. This includes: the H transforms a qubit in |0 state to a superposition state relation between speed of search and the initial amplitude 1 1 √ (|0+|1) and |1 state to a superposition state √ (|0− of the marked state in the database, the relation between the 2 2 search speed and the quantum search engine. In Section 10, |1). In a quantum system of n-qubit, H transformation is we give an error tolerance analysis of quantum search algo- performed on each of the n qubit independently to realize rithms. In Section 11, we briefly review a classical parallel the W transformation. Then the total unitary operation is implementation of the quantum search algorithm. By using denoted as classical parallelism, additional speedup can be obtained at W = H⊗n the expense of more qubit resources. In Section 12, a sum- and the elements of matrix are mary and discussion is given about the experimental imple- −n/2 ¯i·¯j mentations of the quantum search algorithm and other re- Wij =2 (−1) , lated issues. where ¯i and ¯j are the binary representations of i and j re- 中国科技论文在线 http://www.paper.edu.cn 249

spectively, ¯i · ¯j denotes the bitwise inner product of the gorithm [11, 12] and its later version [22]. In the first version strings ¯i and ¯j. [11, 12], the D operation was implemented by two Walsh- Specifically, the Grover algorithm has the following pro- Hadamard gates with the operation −I0 whose action is to cedures. inverse the signs of all components except the |0 basis state. D Database construction Initialize√ the√ quantum√ register In its later version, the minus sign in was ignored, and it / N, / N, / N,..., I to√ the evenly distributed state (1 1 1 was implemented by two Walsh-Hadamard and the 0 oper- 1/ N). This superposition state requires O(log N) steps. ator whose action is to inverse the sign of |0 component and The initial state can be written as leaves other amplitudes untouched. In this review article, we  adopt the later version. The diffusion transform D can be |ψ  W |  1 |i β|τ β|c, 0 = 0 = N =sin +cos (2) i expressed as ⎧ where ⎪ 2   ⎨⎪ ,i= j 1  1 N |c = |i,β=arcsin . (3) Dij = . (4) N − 1 N ⎪ i=τ ⎩ 2 − ,i j N 1 = Finding√ the marked item Perform the following it- eration O( N) times. Then measure the resulting state, D can be further represented in the form D = −I +2P , n n there will be a big probability that the measured result is where I is the 2 × 2 identity matrix and P is the projec- the marked item |τ. Each Grover iteration consists of four tion matrix with Pij =1/N for all i, j. It can be easily found 2 steps: that P = P and P transforms any vector v¯ to a new vector 1) inversion of the marked state; whose components are equal to the average of all compo- 2) the Walsh-Hadamard transformation; nents. Consider what happens when D acts on an arbitrary 3) inversion of all states except the |0 ···state; vector v¯. Operator D can be expressed as −I +2P ,sothe 4) another Walsh-Hadamard transformation. following action can be obtained: These four steps consist of one Grover iteration. The number Dv¯ =(−I +2P )¯v = −v¯ +2P v.¯ (5) of queries used in finding the marked state is used to measure the of a search algorithm. The Suppose A is the average of all components of the vector v¯, computational complexity of quantum search algorithm and so each component of the vector P v¯ is A. Therefore, the i-th related algorithms have been studied in Refs. [14–17], we do component of the vector Dv¯ is given by (−v i +2A) which is not review this topic in this review article. It is worth noting precisely the inversion about average. So the effect of Steps that there are two phase inversions in a Grover search iter- 2) – 4) is ation. It is the the relation among these two rotation angles D −WI W W |  |−I W |ψψ|−I that have led to the result of phase matching [18–21], which = 0 = (2 0 0 ) =2 (6) will be reviewed shortly. where |ψ is the evenly distributed state. Thus the Grover |τ The inversion of the marked state requires the use of search operator G is writtens the query function C(S). Consider the system in any basis state S,ifC(S)=1, rotate the state phase by π radians; If G = −WI0WIτ =(2|ψψ|−I)(I − 2|ττ|). (7) C(S)=0, leave the state unaltered. This inversion of the Grover algorithm has a simple 2-dimensional visualiza- marked state can be expressed as Iτ = I − 2|ττ|. tion. In the Hilbert spaces spanned by |τ and |c, G operator Steps 2) – 4) together make the inversion about the av- can be written as erage operation, or the diffusion transform D. The diffusion ⎡ ⎤ transform D is not a local transform, which means that it can ⎢ cos 2β sin 2β ⎥ G ⎣ ⎦ . not be implemented by operation on each qubit separately, = (8) − sin 2β cos β like the W . It involves the use of entangling operation gate such as the control-not gate. This step can be implemented as One iteration is a rotation through 2β, thus after j succes- a product of three unitary operations D = −WI0W , where sive iterations, the state vector becomes |ψj =cos[(2j + I0 = I − 2|00| is the π phase rotation of the |0 state 1)β]|c + sin[(2j +1)β]|τ. To get the maximum probabil- and W is the n-qubit Walsh-Hadamard operation. There is a ity, the condition sin[(2j +1)β]=1should be satisfied, the minor difference between the first version of the Grover al- optimal number of iterations is obtained 中国科技论文在线 http://www.paper.edu.cn

250 ⎧ ⎨ Efficient quantum search algorithms do exist for database of jm, if jm is an integer; j op = ⎩ the form [25], INT[jm]+1, if jm is not an integer, |ψ  θ |τ θ eiδ|c, (9) 0 =sin 0 +cos 0 (11) π 1 where sin θ0 is the amplitude of the marked state in the where jm = − and INT[·] means taking the integer 4β 2 √ database, and δ is the initial phase of the database. Of course, j ≈ π N/ part. It is clear that op 4. one may also write a phase factor δτ in the |τ term to form j P iδ iδ The number op determines max, the maximum proba- the database, sin θ0e τ |τ +cosθ0e c |c. However, we can j β bility of obtaining the marked state. Note that (2 op +1) treat it as a global phase, and subtract it from δc and using π/ may not be exactly 2, the maximum probability is usually δ = δc − δτ in Eq. (11) instead. not 100%. There is also the over-cooking and under-cooking A quantum search engine is a searching operator. In the problem associated with the Grover algorithm. When one standard Grover algorithm, the search engine is given in Eq. j measures at an iteration time greater than op, the probabil- (7) or (8). In a QAA [22–24], the search engine is ity becomes less than Pmax. This is quite similar to the over- G −UI U −1I . cooking in boiling rice. When one measures at an iteration = γ τ (12) number less than jop, the probability of finding the marked In the quantum search algorithm with non-π phases [18, 21, state is also less than Pmax. This is the under-cooking prob- 28], the search engine is lem. −1 G = −UR0U Rτ , (13) where R I − − eiθ |  |, |ψ  0 = (1 ) 0 0 It is interesting to note that the initial state is 0 = (14) W | ··· G iφ 0 , and the Grover search operator is = Rτ = I − (1 − e )|ττ|, −WI0WIτ . One important generalization of the Grover are the phase rotations of the |0 state through θ and the |τ algorithm is the quantum amplitude amplification [22–24]. through φ respectively. In QAA the initial state is U|γ and the search operator −1 The query function, or the oracle is the most intriguing as −UIγ U Iτ . Many authors consider wrongly that the part of a quantum search algorithm. It can be understood database and the search operator are related in only such a in two ways. First, like in the theoretical study of quantum way, namely the unitary operation to transform |0 to the search algorithm, the query is treated as a blackbox. Namely initial state and the unitary operation in the search operator someone has already known the marked state, and he/she are the same. This misconception leads to some wrong con- prepared a blackbox containing this information and gave clusions about the search speed with respect to the marked the blackbox to someone else and let him to find the marked state component in the initial state. For this purpose, Long state. Such a contesting game view is both easy to under- et al separated the quantum search algorithm into explicitly stand and good for theoretical study. the search engine and the database [25]. The second way is closer to practical application, and the A quantum database is the initial state where a quantum query function is a computable function. For instance in the search algorithm starts searching. In the standard Grover satisfiability problem in which the existence of solution to a algorithm, it is the evenly distributed superposition state in logic expression is sought, the query function is just the logic Eq. (2). Of course it can be prepared by applying the Walsh- expression. For instance, for a Boolean expression with four Hadamard gate on the |0 state. It should be emphasized variables x1, x2, x3 and x4, one needs to find the solution to that the database is not necessarily this form in general. For the logic expression instance, it can be written as an arbitrary superposition of the basis states in a form, x1x3 + x2x4 =1, (15)

|ψ0 = a0|0 + a1|1 + ···+ ai|i + ···, (10) the query function can be constructed by the quantum cir- where the coefficient of each basis state is arbitrary. It should cuit shown in Fig.1. 1-4 are the working qubits, be pointed out that searching in such a database is usually not and qubits 5 and 6 hold the values of x1x3 and x2x4 re- very efficient. Biron et al. have studied the search process in spectively. Qubit 7 gives the value of the logic expression such database using the standard Grover search engine [26]. x1x3 + x2x4. Then using qubit 7 as a control, and another 中国科技论文在线 http://www.paper.edu.cn

251

auxiliary qubit as the target qubit, the selective inversion can state |ψ0 to |ψ =cos[(2j +1)β ]|c+sin [(2j +1)β ]|τ. be implemented. The optimal iteration number is ⎧ ⎪ ⎨ j , j m if m is an integer; jop = ⎩⎪ INT[jm]+1, if jm is not an integer, (19) where π 1 j = − . m 4β 2 After the jop-th iteration, an observation in the computa-

Fig. 1 A for the query function x1x3 + x2x4 tional basis produces with high probability one of the marked items in a superposition of the M marked items. At first, it may seem surprising that finding M marked items is easier than finding a single marked item. One should j ≈ π/ N/M There are several generalizations on the original Grover al- not be confused here because after op ( 4) iter- M gorithm. Here are some of them. ations, the state is near the superposition of marked items. M First, Grover search algorithm was expanded to the multi- It is a chained “needles”. If a measurement is performed, marked situation [22, 23]. Suppose the number of the solu- only one of the marked item is obtained. Then the algorithm tions to the search algorithm is M, using the same four steps has to be run from the start. Repeating this procedure again M given in Section 2 and replacing the inversion of a single and again, then all marked items are found. A detailed marked item with the inversion of all the marked states, M analysis of the total number of steps has been given by Shang [27], marked states can be found. Two normalized basis states are    M−1   defined, −1 M π N q = 1+ ln δ−1 ln , (20) 1 k 4 M |τ = √ (|τ1 + |τ2 + |τ3 + ...+ |τM ), k=1 M − δ 1  (16) where (1 ) is the probability of the algorithm in finding |c = √ |i. N − M one marked state. i=τ Secondly, when the Walsh-Hadamard transformation is The initial state can be written as replaced by arbitrary unitary transformation U, the search |ψ0 =sinβ |τ +cosβ |c, (17) algorithm is still successful. This is the quantum ampli-  tude amplification [22, 23]. Then the search operation is where β =arcsin M/N. In fact, the effect of Grover iter- † G = −UIγU Iτ , where |τ is the marked state, |γ is the ation can be regarded as a rotation in the two-dimensional prepared state. Usually γ =0, then WI0W is the inversion Hilbert space spanned by states |τ and |c. The ora- about average. However in QAA, the initial state and the cle operation Iτ performs a reflection about the vector |τ unitary operator in the search engine is related and taken as in the two-dimensional Hilbert space. Its performance is |ψ  U|  β|τ β|c, Iτ (a|τ + b|c)=−a|τ + b|c. Similarly, D performs a 0 = 0 =sin +cos (21) |ψ reflection about the evenly distributed vector in the plane where defined by |τ and |c. Thus a Grover iteration can also be regarded as two successive reflections which results a rota- sin β = |τ|U|0|,  β |τ (22) tion through 2 . In the 2-dimensional space spanned by |c = |ii|U|0/ cos β. and |c, a Grover iteration can be written in the matrix form i=τ ⎡ ⎤ The number of required iteration is jop ≈ π/(4|Uτγ|). ⎢ cos 2β sin 2β ⎥ √ G = ⎣ ⎦ , (18) Ostensibly, if |Uτγ| > 1/ N, this algorithm would be − sin 2β cos 2β faster than the standard Grover algorithm. However we will which is also a rotation through 2β . Then j times of con- point out in a later section of this paper that this is not true, tinued application of Grover iteration take evenly distributed though it is mathematically valid. Such a generalization is 中国科技论文在线 http://www.paper.edu.cn

252

only meaningful mathematically, and it can not be used in It was discovered almost three years after its invention that practical applications in general if no prior knowledge about arbitrary phase rotation of the marked state will destroy the probability of the marked state in the database is known. If quantum search [18], and when both phase inversions are re- some prior knowledge about the marked state, for instance placed by arbitrary phase rotations, the search algorithm fails the probability of finding the marked state in the database, in general [19]. To construct an efficient quantum search al- 2 namely the square of its amplitude norm |a τ | , is known gorithm, a phase matching condition must be satisfied [19]. beforehand, then the problem is not exactly the unsorted We call a standard quantum search problem or standard database search problem. This should be kept in mind. The UDS problem as the following: given a database |ψ 0 = −1 QAA will be reviewed more detailedly in Section 7. U|0 and a search engine G = −UR0U Rτ to find the Thirdly, it has been generalized to the case that the marked state |τ. This includes the problems in the stan- initial state is not evenly distributed, i.e., the quantum dard Grover algorithm and the QAA. For standard quantum database is no longer the evenly distributed superposi- search problem, the phase matching condition is θ = φ. 1 tion, √ {|0 + |1 + |2 + ···|τ + ···|N − 1}. This However it should be pointed out that phase matching con- N dition depends both on the search engine and the database. has been investigated in Refs. [26, 28] where |ψ 0 = |ψ  θ |τ a |  a |  a |  ··· For a more general database of the form 0 =sin 0 + 0 0 + 1 1 + 3 3 + . Ref. [26] uses the standard iδ cos θ0e |c, where θ0 and δ are the parameters in the ini- Grover search engine, and Ref. [28] uses non-π phase rota- tial state, a compact expression for the phase matching is tion search engines. In some literatures, the difference be- obtained [25]. tween the U in creating the initial state |ψ0 = U |0 and the unitary transformation U in the quantum search engine 5.1 Phase matching in standard UDS problem is not paid attention. This causes some confusion in the lit- It was found that an arbitrary phase rotation of the marked eratures. We will clear this misunderstanding later. state and the inversion about average did not work as a good Fourthly, the two phase inversions can be, and must be re- quantum search algorithm, except angles of (2i +1)π where placed, if a good quantum search is required, by a phase ro- i is an integer [18], which is equivalent to a phase inversion. tations satisfying a phase matching requirement [18–21]. As The quantum search engine with phase rotation angles θ and is well-known, the original Grover algorithm is an approx- φ is imate search algorithm that succeeds only probabilistically. −1 A quantum search algorithm that succeeds with certainty, the G = −UR0U Rτ ,

Long algorithm, is best realized by replacing the two phase iθ R0 = I +(e − 1)|00|, (23) inversions with data size dependent phase rotations of angles  iφ smaller than π, as given in Ref. [21]. Rτ = I +(e − 1) |τkτk|. We will contribute the next section to this important de- k velopment of phase matching We replace the phase inversion of the marked state by a phase rotation with φ and retain the inversion of the aver- age state. Through direct calculation, it was found that the algorithm did not search in the way as expected, it fails to- There are two phase inversions in the Grover search en- tally [18]. The following Fig. 2 shows that the norm of the gine, one for the marked state and the other for the |0 state. amplitude of the marked state Bj+1 after j iterations is in There were speculations that these two inversions could be a narrow range. The numerical study was performed with replaced by arbitrary phase rotations. It is easy to see that if N = 100 where N is the database size. It is interesting to one does not inverse the marked state, then the Grover algo- see that the biggest probability is less than 1% and the lowest rithm does not increase the probability of the marked state. probability is not zero. The study has firmly shown that ar- It was tempting to think that using a phase rotation of the bitrary phase rotation of the marked state can not constitute marked state between 0 and π, one would produce a search a good quantum search algorithm. engine with a slower speed [29]. It was also anticipated The Q-presentation and the G-presentation In science that arbitrary phase rotations in the search engine would also history, different authors use different notations, and even work well for quantum search, though with a slower speed the same author may use different notations in different pe- [22]. riods. In quantum search study, the same situation occurs. 中国科技论文在线 http://www.paper.edu.cn

253

where K = eiφ(1 − (1 − eiθ)). To investigate the effect of different phase rotations, we multiply the Q matrix specified by θ and φ a given num- ber of times and then obtain the amplitude for the marked state. For simplicity, let N = 100, |γ = |0 and U = W . It is found that there exists a phase matching condition cor- responding to a good quantum search algorithm, this phase matching condition is θ = φ. (If the original version of the Grover algorithm [12] was adopted, namely the second phase inversion is performed on all basis states except the

Fig. 2 The amplitude of the marked state Bj+1 versus iteration number |0 state, the phase matching condition is θ + φ =2π.) j [18] Figure 3 shows the norm of the amplitude of the marked φ θ |B | Here we give two presentations of the quantum search al- state after 8 iterations as a function of and for 8 . The gorithm. To avoid errors in this review, we adopt the pre- 3D figure shows clearly the mountain peaks along the phase θ φ sentations of the original papers. In the presentation in Ref. matching condition = , the values are far less than 1 for θ φ [19], the database, namely the initial state of the quantum the other values of and . computer, is chosen −1 −1 |ψQ0 = B0U |τ + A0U |c, (24)   1 where |c = |i. The quantum search engine i=τ N − 1 is defined by the following operator −1 Q = −R0U Rτ U. (25) We call this presentation as the Q-presentation. It is related to the G-presentation of the search problem, in which the −1 database is U|0 and the search engine is −UR0U Rτ ,as follows

|ψ0 = U|ψQ0, (26) Fig. 3 3D plot for |B8| versus θ and φ [19] G = UQU−1. (27) Figure 4 shows the norm of the amplitude of the marked Since G...G|ψ0 = UQ...Q|ψQ0, in the Q-presentation of state as a function of θ and j for φ = π/2. From the 3D plot, the search problem, the search procedure is√ modified as, op- one can see that |Bj| behaviors like | sin | as a function of j erating Q operation on the |ψQ0 state O( N) number of when phase matching condition is satisfied. In other areas, U times, and then apply the operator on the state once more, the values of |Bj| are small. It is only with phase matching and then perform a measurement on the quantum register to read out the result. The coefficient before U −1|τ is the for finding the marked state. Hence the result obtained from Q-presentation is directly applica- ble to G-presentation. We further studied the quantum search algorithm with both phase inversions being replaced by arbitrary phase ro- tations of angles φ and θ for the marked state and the |0 state. In the space span by U −1|τ and −U −1|c and, the Q operator can be written as     2 ∗ 2 −K 1 −|Uτγ| −U K 1 −|Uτγ| τγ Fig. 4 3D plot for |Bj | versus θ and j, φ = π/2 and θ is in unit of  , (28) iθ 2 iθ 2 iθ −(1 − e )Uτγ 1 −|Uτγ| −e −|Uτγ|(1 − e ) π/10[19] 中国科技论文在线 http://www.paper.edu.cn

254

that we can construct a good quantum search algorithm. Ap- When the phase matching condition is not satisfied, i.e. proximate expressions were obtained for the quantum search θ = φ, the transform of j times of Q operators for a small β algorithm [19]. The matrix elements of the unitary transfor- is U mation is represented by Qj ≈ ⎡   ⎤ U eiζ β , 2ijδ τγ = sin( ) (29) 1 − e √ e−ijδ e−i(j−1)δ β ⎢ − e2iδ ⎥ where β is small and in the order of 1/ N. Transformation ⎢   1 ⎥ ⎣ 1 − e2ijδ ⎦ Q can be written approximately −e−i(j−1)δ β eijδ ⎡ ⎤ ⎡ ⎤ 1 − e2iδ iφ+θ θ 2 −iθ/2 −iζ (36) . ⎢ −ie 0 ⎥ ⎢ −ie 2sin 2 e β ⎥ Q=⎣ ⎦ ⎣ ⎦ . δ θ − φ / Qj iθ θ iθ where =( ) 2. When the transformation of is 2 iζβ 2 0 ie 2sin(2 )e ie −1 −1 applied to the initial state B0U |τ + A0U |c, the am- (30) plitude of the marked state is i(φ+θ)/2   By ignoring an overall phase factor e , and let β = 2ijδ −i(j−1)δ 1 − e −ijδ 2sin(θ/2)β, then Bj = e β A0 + e B0 (37) ⎡ ⎤ 1 − e2iδ −i(θ−φ)/2 i(φ/2−ζ) . ⎢ e −iβ e ⎥ B0 is usually a small value, then the effectiveness of the al- Q ⎣ ⎦ . = (31) − e2ijδ / − e2iδ −iβe−i(φ/2−ζ) ei(θ−φ)/2 gorithm depends on the factor (1 ) (1 ). When δ is close to zero, this factor is in the order of j, and the am- When the phase matching condition is satisfied, Q can be plitude of marked state increases in the process of iterations. reexpressed When δ is much larger than zero, the factor is in the order of ⎡ ⎤ 1, thus the amplitude will not be enhanced and the algorithm i(φ/2−ζ) . ⎢ 1 −iβ e ⎥ fails. Q = ⎣ ⎦ −iβe−i(φ/2−ζ) 1 5.2 SO(3) picture for quantum search algorithm βP = I + β P ≈ e , (32) Part of the reason for the wrong anticipation of arbitrary phases in quantum search algorithm was due to the abstract where ⎡ ⎤ nature of U(2) group. It was apparent that a quantum search −iei(φ/2−ζ) ⎢ 0 ⎥ U P = ⎣ ⎦ . (33) iteration is an element of the (2) group spanned by the ba- −ie−i(φ/2−ζ) 0 sis vectors |τ and |c. To make the search problem clear, we have established a three-dimensional picture [21] by us- −i(φ/2−ζ) Considering the phase factor −ie can be ab- ing the isomorphism between O(3) group and U(2) group sorbed to the basis vectors, we have j times of Q transfor- [30]. mation The G operator in Eq. (23) can be written as . Qj jβ I jβ P =cos(⎡ ) +sin( ) ⎤ −e−iφ/2 θ θ (cos 2 + i cos 2β sin 2 ) jβ jβ G = . ⎢ cos( )sin( ) ⎥ −iφ θ 2 = ⎣ ⎦ . (34) −ie sin 2β sin 2 − jβ jβ sin( )cos( ) iφ θ −ie 2 sin 2β sin 2 , Qj B U −1|τ A U −1|c (38) Applying on the initial state 0 + 0 = −eiφ/2 θ − i β θ −1 −1 −1 (cos 2 cos 2 sin 2 ) sin β0U |τ +cosβ0U |c, the amplitude of the U |τ iζ state becomes where Uτ0 = e sin β. It corresponds to a rotation in 3- B jβ β . dimensional space j =sin( + 0) (35) ⎛ ⎞ To get the maximum probability for the marked state, one ⎜ R11 R12 R13 ⎟ ⎜ ⎟ can stop at the step jm for which the condition sin(jmβ + ⎜ ⎟ RG = ⎜ R21 R22 R23 ⎟ , (39) β0) ≈ 1 and jm is an integer, and then apply U on the quan- ⎝ ⎠ tum register and makes a measurement on the register. The R31 R32 R33 marked state will be obtained with probability of almost 1. where 中国科技论文在线 http://www.paper.edu.cn

255

2 2 (x =0,y =0,z =1). The initial state vector is near the R11 =cosφ(cos 2β cos θ+sin 2β)+cos2β sin θ sin φ,  N − 1 2 south pole with the coordinate , 0, −1+ . R12 =cos2β cos φ sin θ − cos θ sin φ, N 2 N 2 θ When phase matching condition, θ = φ, is satisfied, the R13 = − cos φ sin 4β sin +sin2β sin θ sin φ, 2  rotational axis is 2 θ ⎛ ⎞ R21 = − cos 2β cos φ sin θ + cos φ  2 ⎜ cos ⎟ θ ⎜ 2 ⎟ − β 2 φ, ⎜ φ ⎟ cos 4 sin sin l ⎜ ⎟ . 2 G = ⎜ sin ⎟ (46) ⎝ 2 ⎠ R22 =cosθ cos φ +cos2β sin θ sin φ, (40) φ cos tan β 2 θ 2 R23 = − cos φ sin 2β sin θ − sin 4β sin sin φ, 2 For the standard Grover algorithm, θ = φ = π, the ro- θ 2 tational axis is the y-axis, and the rotational angle α = R31 = − sin 4β sin ,  2 4arcsin 1/N . R β θ, 32 =sin2 sin When phase matching condition is not satisfied, the state 2 2 R33 =cos 2β +cosθ sin 2β. (41) vector does not go past the target point. For instance if φ = 0, θ = π, namely we do not rotate the marked state while This is a rotation about the axis |  z ⎛ ⎞ rotating the 0 state, then the rotational axis is the -axis, φ the search algorithm rotates the state vector in the x-y-plane, ⎜ cot ⎟ ⎜ 2 ⎟ ⎜ ⎟ and it does not increase the probability at all. l = ⎜ 1 ⎟ , (42) ⎝ ⎠ φ θ 5.3 Phase matching for a more general database − cot 2β cot +cot csc 2β 2 2 Phase matching condition depends on both the search engine through an angle α, and the database. In general, the database state can be ob-   tained by applying a unitary transformation on the |0 state, 1 2 1 α = arccos (cos 4β+3)cosθ cos φ+sin 2β cos φ |ψ0 = U |0. The unitary transformation U can be worked 4 2 out efficiently using the method given in Ref. [31]. This   2 θ unitary transformation may be different from the unitary op- − sin +cos2β sin θ sin φ . (43) −1 2 eration in the quantum search engine G = −UR0U Rτ . For a more general database with the form A state |ψ =(a + ib)|τ +(c + di)|c corre- iδ sponds to a vector in a 3-dimensional space |ψ0 =sinθ0|τ +cosθ0e |c, (47) we have worked out the phase matching condition for such rψ = ψ| σ|ψ ⎛ ⎞ a more general quantum database which is reported in Ref. ⎜ 2(ac + bd) ⎟ [25]. ⎜ ⎟ ⎜ ⎟ We use the SO(3) picture described in Ref. [19]. In = ⎜ 2(ad − bc) ⎟ . (44) ⎝ ⎠ this picture, each searching iteration is a rotation of the 3- a2 + b2 − c2 − d2 dimensional state vector through angle α. After j iterations, the total angle rotated is The probability of finding the marked state is ω = jα, z +1 P = a2 + b2 = , 2 and the state vector is rotated to where z is the third component of rψ. From this result, it rj = r0 cos ω + ln(ln · r0)(1 − cos ω) is very clear about the process of a quantum search algo- +(ln ⊗ r0)sinω, (48) rithm: a quantum search algorithm is a series of rotations of · ⊗ the state vector rψ about the axis l. Each search operation where‘ ’ and ‘ ’ are the ordinary scalar product and vector r rotates the state vector through an angle α. To be a success- product operations. 0 is the state vector in 3-dimensional l ful quantum search algorithm, the trace of the rotated state space corresponding to state (47). The vector n is the axis vector should go past the target point which is the north pole vector (42) normalized to unity. Using Eqs. (48) and (45), 中国科技论文在线 http://www.paper.edu.cn

256 π the probability for finding the marked state can be easily cal- In Eq. (50), θinit = − mϑ, where ϑ =arcsin   2 culated. θ sin sin 2β , and m is an integer During a searching process, the trajectory of the state vec- 2 tor (44) forms a cone whose rotational axis is given by (42). π Starting from an initial position r0, the displacement vector m =INT − β /ϑ . (51) 2 r − r0 is always perpendicular to the rotational axis. If the quantum searching process can find the marked state, then It has been carefully checked that, by using the initial state of T φ θ 2 the vector rf =(0, 0, 1) (T means transpose) must be on (50), φ determined by tan =tan (1 − 2sin β) fulfills 2 2 the trajectory, thus ( rf − r0) · l =0. By putting the initial the general phase matching condition (49) as shown in Ref. state (47) into this equation, we obtain the following phase [25]. matching condition |ψ0 = U|0 =sinβ|τ +cosβ|c θ 2. tan [cos 2β +tanθ0 cos δ sin 2β] This is the database in the standard quantum search prob- 2 φ θ lem. Putting the database =tan 1 − tan θ0 sin δ sin 2β tan . (49) 2 2 |ψ0 = U|0 =sinβ|τ +cosβ|c, This is the phase matching condition for a successful quan-

tum search algorithm in a more general quantum database. into Eq. (49) and letting θ0 = β and δ =0, we obtain This phase matching condition tells us that the rotational an- θ φ gles depend on both the unitary transformation through β tan (cos 2β +tan2β sin β)=tan . 2 2 and on the initial distribution through θ 0 and δ. It should Using the fact that cos 2β +tanβ sin 2β =cos2 β −sin2 β + be pointed out that this condition is a necessary condition 2sin2 β =1,weget for searching with certainty, but not a sufficient one. Even θ φ if this condition is met, the probability for finding marked tan =tan , or θ = φ. 2 2 state is not guaranteed to be 1. The standard Grover al- This is the result that was obtained approximately in Ref. gorithm is one example. In the Grover algorithm [11], the [19], and exactly in Ref. [20] from an SO(3) picture. probability of finding the marked state with optimal itera- 2 1 |ψ  tions is sin [(2jop +1)β].Asβ =arcsin√ is fixed, 3. 0 used by Brassard et al. [24] N In Ref. [24], a procedure was proposed for obtaining the (2jop +1)β may not be exactly π/2. Hence it is closed to marked state with certainty. The strategy is to run the search one for a very large database. However the standard Grover algorithm m = jop − 1 (jop is given in (9)) number of iter- algorithms runs into difficulty when the database size be- ations with θ = φ = π. At this stage, the state vector of the comes small, for instance it usually has a nonzero probability quantum computer is just one step short of the marked state: of failure, and it fails totally when the database has only two |ψ0 = sin((2m +1)β)|τ + cos((2m +1)β)|c. After- items. On the other hand, even with a very large database, wards, one does one more search with θ and φ determined the Grover algorithm also runs into difficulty when the num- by the following equation ber of marked states is large, for instance in the order of a −1 fraction of N, the size of the database. iφ θ cot{(2m +1)β}=e sin(2β) −cos(2β)+i cot . 2 5.4 Examples of phase matching conditions (52) It has been shown that the phase matching condition depends It is easy to show that the θ and φ determined in this way both on the structure of the quantum search engine and on satisfy the general phase matching condition (49). The real the initial state. Here we give four examples of phase match- and the imaginary part of Eq. (52), give respectively, ing condition which are special cases of the phase matching

condition (49). cos φ tan θ0 sin 2β = − cos 2β, |ψ  θ |τ θ eiu|c 1. 0 =sin( init) +cos( init) θ sin φ tan θ0 sin 2β =cot . In Ref. [32], starting from U|0 =sinβ|τ +cosβ|c, 2 the following quantum database is prepared Here we have denoted θ0 =(2m +1)β. It is then straight- iu |ψ0 =sin(θinit)|τ +cos(θinit)e |c. (50) forward to show that 中国科技论文在线 http://www.paper.edu.cn

257

− cos 2β 1 − database into two halves and searches one half to see if the φ tan θ0 sin 2β tan = marked state is within that half. If the marked state is within 2 θ cot that half, he/she continues to divide the half into further two 2 halves. If the marked state is not within that half, he/she tan θ0 sin 2β continues the search in the other half. As this process con- θ =tan [cos 2β +tanθ0 sin 2β] , tinues, the size of the database becomes smaller and smaller, 2 and the standard Grover algorithm will run into difficulty. which is exactly the phase matching condition (49) with δ = For instance in a database with only two items, the stan- 0. dard Grover algorithm fails. Closely related to this, when the number of marked items is large, which is equivalent to 4. “Difficult search problem limit” of arbitrary initial dis- a small database, the standard Grover algorithm fails. Thus tribution by Biham et al. [28] searching with certainty is very important in some cases such Phase matching condition strongly depends on the as the two examples listed above. Chi has already noticed database state. Biham et al. have studied the generalized this, and gave an algorithm for searching a database when quantum search algorithm with non-π phase rotations in an there are many marked states [39]. arbitrary database [28]. The quantum search engine they An exact quantum search algorithm was constructed by used is of the form in Eq. (23) and with U = W , the Walsh- using a phase rotation that depends on the size of the Hadamard transformation. In general, no phase matching database, the Long algorithm [21]. In fact, the Long algo- condition is possible. However under certain circumstance, rithm gives a series of exact search algorithms for each given it is possible to find a phase matching condition. For instance database size. The fastest Long algorithm uses JL = jop under the “difficult search problem limit” case, the phase number of steps given in Eq. (9). The next one uses condition θ = φ can be obtained. The “difficult search prob- JL = jop +1number of steps and so on. Starting from lem limit” is the following: N  Nτ  1 [28], which gives ¯ −1/2 ¯ the usual quantum database the weighted averages |k (0)| = O(Wk ) and |l (0)| =  O(1). This is equivalent to the case of |ψ0 = U|0. Thus it |ψ  1 |  |  ··· |τ ··· |N −  , 0 = N ( 0 + 1 + + + + 1 ) (53) gives the same phase matching condition θ = φ. To summarize briefly, original Grover’s quantum search and using the phase matching condition, the rotation angles |  φ algorithm can be generalized to a new search algorithm by of the marked state and 0 state are both angle , thus the L using non-π phase rotations instead of phase inversions, but search iteration transformation is

the phase rotation angles must satisfy a matching condi- L = −WR0WRτ , tion. The phase matching requirement plays a crucial role R I eiφ − |ττ|, (54) in the successful probability of a quantum search algorithm. τ = +( 1) iφ It is also vital to experimental realization of the algorithm. R0 = I +(e − 1)|00|, Any imperfect can lead to the phase mis- where matching and reduce the efficiency of the algorithm [33–35].     π √ The invariants in Grover algorithm have been studied in φ =2arcsin sin N ,JL  Jop. 4JL +2 Ref. [36], and the nonsymmetric effect, which is the effect (55) of V and U in the quantum search engine −I 0VIτ U, has M been studied in Ref. [37]. When there are marked states,√ the corresponding rotation N N/M angle is obtained by replacing with , or using β =arcsin M/N. In a two-dimensional Hilbert space spanned by the basis of |τ and |c, then search operator L can be expressed in In the original Grover’s quantum search algorithm, the prob- matrix form ability of getting the marked state is not 100%. Especially in problems that the dimension of Hilbert space is not so L = −WR0WRτ  big, using a search algorithm with certainty becomes very −eiφ(1 + (eiφ − 1) sin2 β) −(eiφ − 1) sin β cos β = . important. For instance, one can vary the search algorithm −eiφ(eiφ − 1) sin β cos β −eiφ +(eiφ − 1) sin2 β with a verifier-based search approach [38]: one divides the (56) 中国科技论文在线 http://www.paper.edu.cn

258 ⎛ ⎞ φ After operating L on the database state JL times and then c 2 β ⎜ cos tan ⎟ perform a measurement on the register, the marked state will ⎜ 2 ⎟ ⎜ φ φ ⎟ −→r ⎜ c β ⎟ , be obtained with certainty. 0 = ⎜ sin cos tan ⎟ (62) ⎝ 2 2 ⎠ To verify the Long algorithm, we use geometric visual- φ SO c cos2 tan2 β ization in the (3) picture. The rotational matrix of the 2 L quantum iteration operator is c / 2 φ/ 2 β ω ⎡ ⎤ where =1 (1 + cos 2tan ). The angle formed by −→ −→ −→ −→ the vectors ri − r0 and rf − r0 is the one the search process ⎢ R11 R12 R13 ⎥ ⎢ ⎥ has to rotate, and it is calculated to be ⎢ ⎥   RL = ⎢ R21 R22 R23 ⎥ , (57) ⎣ ⎦ φ ω = 2 arccos sin sin β . (63) R31 R32 R33 2 If one completes the rotation in JL steps, then we have where   φ 2 2 2 ω = 2 arccos sin sin β R11 =cosφ(cos 2β cos φ +sin 2β)+cos2β sin φ, 2   R12 =cosφ sin φ(cos 2β − 1), φ = JLα =4JL arcsin sin sin β . (64) 2 φ 2 2 R13 = − cos φ sin 4β sin +sin2β sin φ, 2  Solving this equation gives the result shown in Eq. (55). 2 φ R21 = − cos 2β cos φ sin φ + cos In conclusion, marked state can be searched with cer-  2 tainty. The probability of finding the marked state at a given 2 φ − cos 4β sin sin φ, (58) j 2 iteration can be easily obtained. The state vector at the -th 2 2 step is R22 =cos φ +cos2β sin φ, −→ −→ −→ −→ −→ rj ri ln ln · ri − ω 2 φ = cos + ( )(1 cos ) R23 = − cos φ sin 2β sin φ − sin 4β sin sin φ, −→ −→ 2 +(ln ⊗ ri )sinω, (65) 2 θ −→ R31 = − sin 4β sin , l 2 where n is the normalized rotational axis for this searching algorithm. Then probability of finding the marked state is R32 =sin2β sin φ, 2 2 (z +1)/2. R33 =cos 2β +cosφ sin 2β. For expressions in the SU(2) picture, L operator can be RL is a rotation in the around the axis written as ⎛ ⎞ φ 1 L = T Λ T †, (66) ⎜ cos ⎟ N ⎜ 2 ⎟ T −→ ⎜ φ ⎟ l ⎜ ⎟ , where the matrix T is L = ⎜ sin ⎟ (59) 2 −i φ φ ⎝ ⎠ e 2 (cos sin β +cosβ) − cos β φ 2 , cos tan β i φ φ cos βe2 (cos sin β +cosβ) 2 2 through an angle α (67) and φ ⎛ ⎞ α β . =4arcsin sin sin (60) i(φ+2β) 2 ⎜ −e 0 ⎟ Λ=⎝ ⎠ , i(φ−2β) Then the initial state |ψ0 and the marked state |τ corre- 0 −e   spond to 3-dimensional vectors φ ⎛ ⎞ ⎛ ⎞ β = α/4=arcsin sin sin β , 2 ⎜ sin 2β ⎟ ⎜ 0 ⎟   ⎜ ⎟ ⎜ ⎟ φ 2 −→ ⎜ ⎟ −→ ⎜ ⎟ 2 ri = ⎜ 0 ⎟ , rf = ⎜ 1 ⎟ . (61) NT =cos β + cos sin β +cosβ . ⎝ ⎠ ⎝ ⎠ 2 − β cos 2 0 Successive operations of L can be written analytically The vector from the origin to the intersecting point of the through the rotational axis with the rotating plane is Ln = T Λn T †. 中国科技论文在线 http://www.paper.edu.cn

259

±i2θ λ± = e a (71) 2 where sin (θa)=a = Ψ1|Ψ1 and 0  θa  π/2. The quantum search algorithm has been generalized and G rephrased into the so-called quantum amplitude amplifica- Operator boosts the success probability of the quantum tion in [22–24]. Consider a Boolean function χ : X → algorithm, in the eigenvector basis, −i {0, 1} which distinguishes set X between its good (target) iθa −iθa U|0 = |Ψ = √ e |Ψ+−e |Ψ− (72) and bad (non-target) elements, where good elements cor- 2 respond to χ(x)=1and otherwise χ(x)=0. Con- Then after j applications of operator G, the state becomes sider a operation U such that U|0 = −i  Gj|  √ e(2j+1)iθa | −e−(2j+1)iθa |  α |x Ψ = Ψ+ Ψ− x∈X x is a state of the ele- 2 ments X. The operation U makes no measurements. Denote 1 = √ sin((2j +1)θa)|Ψ1 the probability of the good elements that is produced as a if a U|0 is measured. 1 +√ cos((2j +1)θa)|Ψ0. (73) 1 − a 7.1 Quantum amplitude amplification If a measurement is performed after m rounds of ampli- Quantum amplitude amplification is a process of finding a tude amplification, then the outcome is good with probability good x after an expected number of applications of U and 2 √ sin ((2m +1)θa). The two extreme cases are a is either 0 U −1 which is proportional to 1/ a. Quantum amplitude or 1, then the conclusion remains the same. amplification is a generalization of Grover’s searching al- To obtain a high success probability, it is required that gorithm which was restricted to an evenly distributed state. 2 sin ((2m +1)θa) is close to 1. The ability to choose m ap- Quantum amplitude amplification can work no matter the propriately depends on the knowledge about θ a, i.e. depends initial probability of the target state is known ahead of time on the value of a. Then details of the QAA are given for two or not. extreme cases: when the a is known, and when there is no Let H be the Hilbert space representing the state space of prior knowledge about a whatsoever. a quantum system and H can be considered as a direct sum of two subspaces: target subspace and non-target subspace. • Quadratic speedup without knowing a U is a quantum operation which acts on H without measure- Suppose the value of a is not known, there exists a quantum ments. Let the state obtained by applying U to the initial algorithm denoted as GSearch (U, χ) which can find a target zero state be denoted as |Ψ = U|0. Every pure state |Ψ √1 U U −1 a> solution using Θ a applications of and if has the unique decomposition as |Ψ = |Ψ1 + |Ψ0, where 0, or the algorithm will run forever. The complete algorithm |Ψ1 is the projection onto the target subspace and |Ψ 0 is procedures is as follows: the projection onto the non-target subspace. The amplifica- tion process is realized by repeatedly applying the following Algorithm (GSearch(U, χ)) unitary operator G on the state |Ψ, (1) Set l =0and c be any constant such that 1

260

cess probability a  3/4, then step 3 ensures the measure- and suppose m is not an integer. Then the second method ob- ment of a good solution. On the other hand, if 0

261

e2πiω|j|Ψ. Then the following procedures accomplish an Gudder [41]. The corresponding formalism in the density estimate for a, via an estimate for θa. matrix is given by Long in Ref. [42]. Two components are crucial in duality computer: the Algorithm (Est Amp(U, χ, M)) quantum wave divider(QWD) and the QWC. For a single (1) Initialize two registers with appropriate sizes in the particle quantum system, a QWD is just a beamsplitter or a state |0, U|0. double-slits. When a passes it, there are 50% prob- (2) Apply FM operation to the first register. −1 ability to be reflected and 50% probability to be transmitted (3) Apply ΛM (G) operation where G = −UI0U Iχ. −1 through the beamsplitter. But for a multi-photon quantum (4) Apply FM operation to the first register. system, a QWD is much more complicated, and a specific (5) Measure the first register and obtain an outcome |y. 2 implementation of a QWD was given in Ref. [40]. Mathe- (6) Output a =sin (πyM). matically, a n-path QWD, Dp, has the following effect This algorithm can be summarized as a unitary transfor- 1 n mation Dp|ψ = ⊕i=1 pi|ψi, (82) p −1  FM ⊗ I ΛM (G)(FM ⊗ I) (80) where i pi =1, and |ψi is the sub-wave function at path applied on an initial state |0⊗U|0, followed by a mea- i. A QWC, Cp does the reverse, surement on the first register and having a classical post- n n processing outcome. In practice, M could be chosen to be a Cp ⊕pi|ψj(i)i = pi|ψj(i). (83) power of 2, which allows us to replace a Fourier transforma- i i=1 tion in step (2) by a Walsh-Hadamard transformation. After the QWD, the wave splits into two sub-waves in In conclusion, for any positive integer k, the algorithm different paths. One can perform gate operations on each (Est Amp(U, χ, M)) can output an a(0  a  1) satisfy- sub-wave separately. Then the two sub-waves are combined ing in a QWC so that interference may take place. The result  of the calculation can be read out by a final measurement. a(1 − a) π2 |a − a|  πk k2 For a single quantum particle, a QWC is just the screen in a 2 M + M 2 (81) double-slits experiment. However for multi-photon system, when k =1, a will be obtained with probability at least the construction of QWC is complicated and examples were 8/π2; when k  2, a will be obtained with probability 1 given in Ref. [40]. greater than 1 − .Ifa =0, then a =0with cer- 2(k − 1) We should pay attention to the following points. First, on tainty; if a =1and M is an even number, then a =1with a single path, the gate operations is assumed unitary. Uni- certainty. tary operation is performed on a duality computer just as if we were operating on the whole quantum system. Du- bit is on constant , because particle wave duality is reflected when the quantum system is moving. For a quan- A duality computing machine is a new type of computer pro- tum computer, it is usually located at some area in space so posed recently [40]. Correspondingly, the basic element, bit, that when one makes a measurement he/she always finds the in a duality computer is called dubit. It uses the particle- quantum computer there. Though there are some proposed wave duality property of for computa- physical realizations using flying qubits such as , it tion. In a duality computer, the wave functions of the multi- is essentially a quantum particle computer as it is equivalent dubit duality computer can split into two paths. The two to the static quantum computer realization. Though the op- paths have the same spatial length, that is, when a duality eration in each path is unitary, the operation on the whole computer passes through these two paths and recombine its duality computer is not. This is not surprising for we are wave function at a quantum wave combiner(QWC), the spa- considering only part of the space. For instance in the Mach- tial mode of the two sub-waves are in phase. If there is only Zehnder interferometer with a single photon injection, if we one path, then the duality computer reduces to an ordinary just look at one outport we sometimes do not observe a pho- quantum computer. ton. However if we look at both detectors we always observe Soon after the establishment of duality computer, rigorous one when one photon is injected. The non-unitary property mathematical theory of duality computer was established by of operations in duality computer is fundamentally different 中国科技论文在线 http://www.paper.edu.cn

262 from a quantum computer where every gate operation must 1 † † = 2I + U1U2 + U2U1 = I. (86) be unitary. The whole quantum system takes only a single 4 Eqs. (84) or (85) show that the duality computer has a path for a quantum computer. The relationship between duality computer, quantum more powerful parallelism, the duality parallelism. One can perform different operations to the sub-waves in different computer and classical computer can be seen as follows: paths. While in quantum computer, this parallelism is ab- when a duality computer is allowed to compute with only sent. Thus in duality computer, both the products of uni- a single path, duality computer reduces to a quantum com- tary operations and the linear superpositions of unitary oper- puter. There is no duality in a quantum computer, but su- perposition and entanglement are still present in quantum ations are permissible. This contrasts to the quantum com- puter where only the product of unitary operations are al- computer. If we allow a quantum computer to calculate us- 2n × 2n ing only the computational basis states, a quantum computer lowed. Since every matrix can be written as linear combination of unitary matrices, therefore a duality com- reduces to a classical computer where neither superposition puter can implement any type of operations in the Hilbert nor entanglement are present. space. Secondly, besides the QWD and QWC, other gate opera- This is the simplistic duality computer model. Instead of tions are needed to implement the unitary operations in each individual path. It has been proven that a set of basic gate op- dividing the quantum wave into two sub-waves, we can di- vide it into multiple sub-waves. Furthermore, the division erations is sufficient to construct any unitary operation [43]. It is known that single bit rotation gate and two qubit control can also be done for the sub-wave in each path to produce sub-sub-waves. In theory, this division can be performed at not(CNOT) gate form a set of universal gate [44]. This uni- an arbitrary level. This further division does not provide fur- versal set of gate can also be employed in duality computer. ther computing power [45], however provides convenience Of course other sets of universal quantum gate operations and additional benefit in solving a specific problem. We can could also be adopted. As an example, a universal set of du- ality computing gate operations can be: the QWD, QWC, use the number of paths in a QWD and the levels of use of QWD to describe the structure of a duality computer. For 2-dubit CNOT and single bit rotations. Thus the computing process in a quantum duality com- instance we call the DC described in Eq.(84) as a 1-level 2- paths duality computer. If the divider has 3 outputs and in a puter is illustrated as follows path, another QWD is used at path 2, then the duality com- p1|ψ, φ1−→p1U1|ψ, φ1 |ψ, φ −→ QWD QWC puter will be called a 2 level 3-paths duality computer.  p2|ψ, φ2−→p2U2|ψ, φ2 In Ref. [40], the efficiency of the duality computer de-

−→ (p1U1 + p2U2)|ψ, φ, (84) pends on the fundamental interpretation of a measurement on a part of a wave function. If a measurement on a partial where p1  0, p2  0 and p1 + p2 =1. For a symmetric wave function is as efficient as on a whole wave function, duality computer, p1 = p2 =1/2. ψ, the first part in the then the duality computer would have more power than a state ket is the internal wave function which is used for cal- quantum computer. Here we consider the worst case sce- culation in the duality computer, and φ is the spatial wave nario. Here is a search algorithm in the duality computer. function. The gate operation U1 and U2 are both unitary, and they act on the internal wave function. They themselves are 1. Prepare the state of the duality computer in the equally constructed from basic one bit and two bit gate operations. distributed state, However, when they recombine at the QWC, it gives  1 |ψ0 = (|0 + ···+ |τ + ···+ |N − 1), (87) p1U1|ψ, φ1+ p2U2|ψ, φ2→(p1U1 + p2U2)|ψ, φ,(85) N |φ  where the subscript in i has been dropped at the final stage where τ is the marked item we are searching for. because the spatial part of the two sub-waves become identi- 2. Let the duality computer go through QWD, so that it cal at the QWC. It is not unitary. For instance for a symmet- divides the wave into two sub-waves ric QWD and QWC, p1 = p2 =1/2,     † |ψ  √1 |  ··· |τ ··· |N −  , U1 + U2 U1 + U2 u = ( 0 + + + + 1 ) (88) 2 N 2 2 1 † † † † √1 = U1U1 + U2U2 + U1U2 + U2U1 |ψd = (|0 + ···+ |τ + ···+ |N − 1). (89) 4 2 N 中国科技论文在线 http://www.paper.edu.cn

263

3. Apply the query to the lower-path sub-wave, reverse the coefficients of all basis states |i except the marked state |τ, the lower sub-wave becomes There have been some misunderstanding about quantum 1 |ψd = √ (−|0−···+ |τ−···−|N − 1). (90) search algorithms. Recall that we have divided a quan- N 2 tum search algorithm into a quantum database and quantum No operation is applied to the upper-path sub-wave, it re- search engine. Using this division, these misunderstanding mains in state as in Eq. (88). can be cleared easily. 4. Combine the sub-waves at the QWC, and the wave Misunderstanding√ 1 The required number of itera- becomes tions depends on 1/ a where a is the probability of finding  1 the marked state in the initial state, or the database. |ψf  = |τ. (91) N This statement is only true under restrictions, for instance, 5. Make a read-out measurement, and the marked item in QAA. The search speed of a search algorithm depends τ will be found with some probability depending on further mainly on the quantum search engine. The probability in studies on the measurement of a partial wave function as has the initial state or the quantum database provides only the been discussed in [40]. In the best case scenario, the mea- starting point. For instance if we choose the standard Grover surement gives the marked item with certainty. In the worst search engine, and the initial state is taken as case scenario, the probability of obtaining the marked state is |ψ0 =sinθ0|τ +cosθ0|c, (92) 1/N . We can repeat the algorithm N times, the probability then at the j-th step, the state becomes of finding the marked state will be very close to 1. It is interesting to note that, this algorithm is not as fast as |ψj =sin(2jβ + θ0)|τ +cos(2jβ + θ0)|c. (93) O N the Grover algorithm because it requires ( ) steps. How- The number of required iterations to find the marked state is ever it is significant in two aspects. First, it is a quantum j π/ − θ / β . algorithm and uses less resource than a classical algorithm op =( 2 0) (2 ) (94) running on a classical computer. In a classical computer, to For the standard search problem, θ0 = β. It is clear that represent such a database, the number of required is at the probability of marked state in the initial state gives only least N log2 N, whereas in a duality computer,, it requires an offset in the number of required iterations. For small only log2 N dubits. Secondly, it is a fixed point search al- θ0, which may be much smaller than β, the number only gorithm in the same sense with the one proposed recently by increases by 1 step. Even if θ0 is large, in the order of Grover [46]. In Ref. [46, 47], the number of steps taken to π/2, say cπ/2 where c is a constant less than 1, the num- find the marked state is also O(N). The fixed point algo- ber of required iteration reduces only fractionally, j op = rithm has the advantage of avoiding the over-cooking prob- (1−c)π/(4β). This is (1−c) times of the number of required lem of quantum search algorithms, and the algorithm will iteration in the standard Grover algorithm. always give the marked state even if it is not measured at The conclusion in QAA that√ the number of required itera- the optimal iteration. Recently, we have proposed a duality tion is proportional to O(1/ a) is because the search engine computing mode in a quantum computer [48]. In this mode, is related to the database through U, the U in the search en- the duality search algorithm can be run in a quantum com- gine is chosen as the one that transforms the |0 state into puter in recycling way, and the quantum computer will stop the database√ state. Hence the norm of the matrix element of until a marked state is found. |Uτ,0| is 1/ a. In addition, the problem in QAA is somehow The query can be implemented using O(ln N) number of different from the standard unsorted database search because dubits. As the size of the database N increases, the difficulty some prior knowledge about a is known. in constructing the query increases only logarithmically. Misunderstanding 2 The required number of itera- In the duality computer, classical algorithms can be trans- tions is about 1/4|Uτ,0|. lated into duality algorithms easily. For instance, the prime factorization algorithm can be translated into the duality It seems that it is possible to exceeds the speed of the computer similarly [48]. Grover algorithm in finding the marked state, especially 中国科技论文在线 http://www.paper.edu.cn 264 when the |Uτ,0| is large. The mathematical derivation of random variable with mean δ0 =0 and standard deviation s the result is correct, however it is wrong for the unsorted (EM3). database problem. The reason is simple. As U is unitary, In EM1, the phase inversions becomes there must be iθ Rγ = I − (1 − e )|γγ|, N 2 |Uτ,0| =1. (95) iϕ Rτ = I − (1 − e )|ττ|, (96) τ=1 N Since the marked state may be any of the items, the num- where θ = π + θ0,ϕ= π + ϕ0 with θ0 and ϕ0 constant and τ ber of steps for a particular maybe small, however it re- small. Of course when θ0 = ϕ0 =0, we recover the Grover quires much more steps for other possible τ’s. Another algorithm. The generalized quantum search algorithm is a drawback is that it is difficult to determine the optimal num- rotation in a 2-dimensional space spanned by |γ and |τ. ber of steps for such an algorithm because we do not know Usually |γ = |0. In the following two orthonormal basis beforehand which of the state is the marked state. −1 (|γ−UτγU |τ) In quantum amplitude amplification, the unitary operation U −1|c  = 2 (97) 1 −|Uτγ| , U is related to the quantum database through |ψ 0 = U|0. √ Thus the number of steps required in it is proportional to −1 √ and U |τ, with Uτγ =<τ|U|γ>=1/ N, the operator /|U | / a a 1 τ,0 =1 , where is the probability of the good Q is represented by state in the database. However, as just discussed, the prob-  iθ 2 iθ iθ 2 −e −|Uτγ| (1 − e )(1− e )Uτγ 1 −|Uτγ| lem in QAA is somewhat different from that of the unsorted  eiϕ(1 − eiθ)U ∗ 1 −|U |2 −eiϕ[1 − (1 − eiθ)|U |2] database search problem.√ In that case, some states can be τγ τγ τγ O N (98) found with fewer than ( ) steps,√ and some other states O N can be found with more than ( ) steps. Let δ =θ−ϕ=θ0−ϕ0. It has been shown that to construct an efficient quantum search algorithm, θ and ϕ must equal to one another [18–20]. However due to imperfections in gate operations, this phase matching requirement can not be In realistic condition, errors in gate operations are inevitable. strictly satisfied. In the following, we showed that nonzero In a quantum search algorithm, errors occur in two places, constant δ results in exponential reduction in the maximum the phase mismatching and in the Walsh-Hadamard trans- success probability of Grover’s algorithm asymptotically. formation. These errors cause reduction in the successful Since both θ0 and ϕ0 are small, dropping off an overall rate of the search algorithm, and hence restrict the size of phase, we approximate Q as the database. The error tolerance in quantum search algo- . Q =cosδI + i sin δσz + iβ σy + o(β ), (99) rithm has been studied in Ref. [33]. Here we briefly review the main result. where σx,σy and σz are Pauli operators and I is the identity As we know, there are four steps in an iteration [12]: (1) operator in√ dimension 2. β =2β + O(θ0β)=2β + o(β) U W N − a Walsh-Hadamard transformation = ; (2) a phase in- β 1 δ with = N . For small , we can further simplify version of the prepared state |γ, usually |γ = |0, Iγ = operator Q as, I − 2|γγ|; (3) a phase inversion of the marked state |τ, Q ≈ I iP ≈ eiP , Iτ = I −2|ττ| ; and (4) an inverse of the Walsh-Hadamard + U −1 W W 2 2 2 transformation = ( is self-inverse.). We use the with P =sinδσz + β σy. Using P =(δ + β )I,we Q-presentation in this section. The operator for one Grover obtain −1 ⎡ ⎤ iteration in the Q-presentation is Q = −Iγ U Iτ U. δ jλ β jλ jλ i sin sin First, we look at the imperfection in phase inversions and ⎢ cos + λ λ ⎥ Qj = ⎣ ⎦ , therefore choose U to be the ideal Hadamard transformation. β sin jλ δ sin jλ − cos jλ − i Three error models were adopted: the imperfections in the λ λ (100) phase inversion to be systematic, and we call this as error  model 1 (EM1). The second error model (EM2) assumes δ with λ = δ2 + β2. Then, starting from the prepared state  in each step is a Gaussian random variable with mean δ 0 =0 2 −1 −1 |γ = 1 −|Uτγ| U |c + UτγU |τ and standard deviation s. Finally, we let δ be a Gaussian 中国科技论文在线 http://www.paper.edu.cn

265

=cosβU−1|c +sinβU−1|τ≈U −1|c, after j number of iterations, the norm of the amplitude of the marked state in the quantum computer is β |B |≈ jλ . j λ sin( ) (101) and the maximum probability of the marked state in the al- gorithm is β2 Pmax ≈  1. (102) β2 + δ2 Therefore, for large N, Grover’s algorithm is efficient only

when δ =0. When δ =0 ,wefind −2 −3 −4 Fig. 5 EM1 with δ0 = 10 , 10 , 10 [33] β2 P ≈ ∼ 4 . max δ2 Nδ2 (103) Thus, Pmax decreases linearly with N or exponentially with

n =log2 N. This concludes our proof that systematic phase mismatching results in exponential reduction in the success probability and consequently gives an upper bound on the size of the database. The error tolerance requires that N can not exceed O(1/δ2). When there are random errors in the imperfection, we use the second error model, EM2, and the third error model, EM3 if both random and systematic errors are present. The exact effect of EM2 and EM3 are difficult to compute analyt- δ = ,s = −2 λ = β[ ] ically due to their randomness. Hence, we give the simula- Fig. 6 EM2 with 0 0 10 and 33

tion results. We vary n =log2 N and run the algorithm with sufficient number of iterations so that a maximum probabil- ity is found. Since δ in EM2 and EM3 are random variables, we used the random sampling techniques in the simulation. The relationships between the maximum success probabil- ities and the size of the database are shown in Fig. 6 and Fig. 7 for EM2 and EM3 respectively. For comparisons, we also provide the simulation result from EM1 in Fig. 5. The simulated results are consistent with intuitive specula- tion. Both systematic and random errors cause reduction in the maximum probability. The success probability drops

quickly after a transition point, which is determined by the −2 −3 −4 −3 Fig. 7 EM3 with δ0 = 10 , 10 , 10 ,s= 10 [33] error parameter δ0 and s. When n is large, the decreases exponentially. The effects of systematic errors and It is interesting to notice that systematic errors in the phase random errors are different. Systematic errors cause the error inversions lead to reduction in the maximum probability. amplitudes to grow exponentially with the number of gates Random errors also affect this successful rate, but in a lesser applied; while the random errors cause the error probabili- degree. In practice, we should make δ0 as small as possible. ties to grow linearly. This difference has been demonstrated However, due to imperfection, nonzero δ 0 occur inevitably. in the simulation results. Figure 6 shows that random errors Random errors exist always in a realistic environment. These give a much larger transition point than systematic errors. errors reduce the maximum successful probability of the al- Figure 7 shows that the average success probability from gorithm. The combined effect of systematic and random er- EM3 is nearly identical to EM1 except some small fluctu- rors (EM3) was estimated. Assuming that random errors af- ations. fect the algorithm just like the systematic errors, then we 中国科技论文在线 http://www.paper.edu.cn

266 can treat ∆=2δ as the uncertainty due to both system- steps, the modified algorithm has to search the rest of the ba- atic errors and random errors and use this to derive an upper sis states in more steps. In contrast, the a quantum search al- bound for the size of a quantum database(due to uncertainty gorithm using the Walsh-Hadamard transformation searches in the phase inversion, the size of the database has an upper all possible marked state with the same optimal number of bound). iterations. Together with its simpleness and easy implemen- tation, the Walsh-Hadamard transformation lends itself the Imperfect Hadamard transformation Now consider best choice. the errrors in Walsh-Hadamard transformation. To study the The effects of random errors in the Walsh-Hadamard effect of the imperfect Walsh-Hadamard transformation, we transformation was studied in a simple model. With noise, take δ =0in Eq. (100). Then the maximum probability for 2 the algorithm is no longer a rotation in 2 dimensions. In each finding the marked state is approximately sin ((2j+1)β) for iteration, the operator can be approximately written as perfect unitary transformation. For perfect Hadamard-Walsh ⎛ ⎞ β =arcsin(|Uτγ|) |Uτγ| = 1/N transformation, , and . ⎜ cos β sin β ⎟ Q ⎝ ⎠ , For systematic errors in the Walsh-Hadamard transforma- = (104) U /N − sin β cos β tion, the matrix elements of is no longer equal to 1 . |U | /N If τγ is larger than 1 , then the algorithm will require the basis states in each iteration has been changed, that is, less steps in reaching the desired state as compared with the the 2 dimensional space in each iteration is no longer the /N standard Grover’s algorithm. If it is smaller than 1 , the same. This is apparent by inspecting the expressions in Eq. algorithm will require more steps of iteration. In this case, (97). Look at two successive transformation where the first the searching algorithm can still find the marked state with iteration is U and the second is V . After the first iteration, very high probability. But if one makes a measurement at the state vector of the quantum computer is the normal optimal number of iteration, one gets a reduction |ψ1 =cosβ|1−sin β|2 in the probability. The influence due to such error can be ≈ cos β|1−sin βU−1V |2, (105) alleviated by running the algorithm several times with mea- surements made around the optimal iteration. where |1 = U −1|c, |2 = U −1|τ, |2 = V −1|τ Here, we can give a simple explanation why Grover’s al- and |1 = V −1|c. Because U = V , U −1V is no gorithm and the Long algorithm are optimal. The rigor- longer the identity operator. Expanding U −1V |2 = −1 ous proof has been given in Ref. [50]. According to the (U V )22|2 +..., we see that the Grover search operator SO(3)-picture [21], Grover’s algorithm can be seen as a ro- acts only on the subspace span by |1 and |2, and the other tation of the state vector in a 2-dimensional space spanned terms are leaked out the 2 dimensional space. To make an by U −1|τ and U −1|c. Each iteration rotates an angle estimate about the leakage, we assume that in each itera- −1 β =2sin(θ/2)β. When θ = φ = π, the iteration gives tion there exists (U V )22|2 ≈(1 − δ1)|2 + higher order the largest rotational angle 2β =2arcsin(|Uτγ). However, terms. Then in this model, the matrix for a Grover search this largest angle may overshoot the target point at the last it- operator becomes ⎛ ⎞ eration, hence a smaller than π phase rotation gives the right β β − δ final step on the target point, as given in the Long algorithm ⎜ cos sin (1 1) ⎟ Q = ⎝ ⎠ . (106) shown in Eq. (55). − sin β cos β(1 − δ1) Now we show that with noises in the Walsh-Hadamard |γ≈|  transformation, the two dimensional space is no longer Starting from state 1 , and applying the Grover itera- j |  closed during the search iteration. At first glance one may be tion iterations, the amplitude of the basis state 2 becomes   attempted to think that a larger |Uτγ| will constitute a faster j − − 1δ jβ , U 1 1 sin( ) (107) search algorithm. However, since is unitary, its matrix 2 2 elements satisfy the normalization relation τ |Uτγ| =1, where only first order in δ1 is retained. With optimal number where τ runs through all the N basis states. The mean value √  of iterations, j ≈ π N/4, sin(jβ) ≈ 1, the successful rate of the matrix element is 1/N . If some of the matrix el- is ements are larger than the average, some other matrix el- √ 2 √ ements will be smaller than this average. In other words, π Nδ1 π Nδ1 P ≈ 1 − ≈ 1 − . (108) while making the search for some marked states in fewer 8 4 中国科技论文在线 http://www.paper.edu.cn

267

N  4 The density operator of the ensemble is For half success rate, one must have 2 2 , which is ⎡ ⎤ π δ1 N1−1 N2−1 similar to the limitation on the size of the database in the 1 ⎣ ⎦ ρ = cj ,j |0,j1,j2 , N 1 2 (109) phase inversion inaccuracies. 1 j =0 j =0 1 2 d It is interesting to note that in the Grover algorithm sys- where in |i, j1,j2, i, j1 and j2 are the states for the tematic errors in the phase inversions and random errors n n function, the 1- and the 2- registers respectively and in the Walsh-Hadamard transformation are dominant errors. N2−1 2 |cj ,j | =1, and we have defined a short notation This is different to the Shor algorithm where random errors j2=0 1 2 for the of a pure state as are dominant [51, 52]. |ψ |ψψ|. Errors in the Grover algorithm have also been studied nu- [ ]d = (110) merically in Refs. [34, 35, 53]. Errors in the quantum count- The ancilla qubit state is not written out explicitly. In ing has been studied in Ref. [54]. N N this EQC, there are 1 constituents and 1 molecules. N2−1 cj ,j | ,j1,j2 Each molecule is in a different state, j2=0 1 2 0 , which is a superposition of N2 number of computational ba- sis states. In general, a quantum computation performs uni- By introducing classical parallelism, the problem can be fur- tary transformations on both the argument and the function ther speeded up modestly. Using the Br¨uschweileralgorithm registers. Denoting this transformation as Uc, the quantum [55], O(ln N) steps is required to find the marked state. computation on state (109) will be Using the Xiao-Long algorithm, one needs only a single −1 ρ → ρc = UcρUc ⎡ ⎤ query to find the marked state [56]. However this speedup is N1−1 N2−1 1 ⎣ ⎦ achieved at the cost of more computing resources. Namely = cj1,j2 Uc|0,j1,j2 . (111) n1 2 j =0 j =0 now there are O(N) quantum working in paral- 1 2 d lel. In general with N2 quantum computers working in par- A global measurement, which is a measurement on the allel, the number of queries required to find the marked state whole ensemble, is then performed to read out the result. is O( N/N2) in a parallelized quantum computing [57]. The quantum computation represented in Eq. (111) on Though these algorithms achieve speedup by using more re- the ensemble (109) is defined as a classical parallel quantum sources, they are very useful in ensemble quantum comput- computing. In fact it is N1 quantum computers working in ers such as liquid nuclear magnetic resonance [58]. parallel. The computation instruction Uc is the same for all Some quantum algorithms can be further accelerated by molecules, but the , numbers represented by differ- classical parallelism. In addition to the advantage of be- ent molecules, are different. Hence, the PQC is analogous ing faster, it is also of practical importance for a kind of to the single-instruction-multi-data type of parallel compu- quantum computer model, the ensemble quantum computer tation in classical computation. The state (109) is the most n (EQC). An EQC is an ensemble of N1 =2 1 quantum com- general initial state, and in most applications, the following n puters. For instance in an NMR quantum computer, there simplified state is sufficient: the 1-register in the complete 15 N1−1 are O(10 ) number of molecules. Each molecule can be mixed state (1/N1)|j1j1| and the n2-register in the j1=0   N2−1 treated as a quantum computer under ideal condition. Each equally weighted superposed state 1/N2|j2.In √ j2=0 molecule can be operated and measured. Suppose each this case, cj1,j2 =1/ N2 for all possible j1 and j2. molecule has n + m +1qubits. They are divided into 3 Now we inspect the PQC version of the Grover algorithm, m 0 0 parts: 1 ancilla qubit, a function register with qubits, and or the Long algorithm. Suppose the marked state is |j 1 j2 . an argument register with n qubits. The argument register is Only one qubit is required for the function register in this further divided into two parts: one part with n 1 qubits sim- algorithm. This qubit is also used as the ancilla qubit for the ply called n1-register and another part with n2 qubits called global measurement. Preparing the function register in the n2-register, and n = n1 + n2. In general before a compu- |0 state, the n2-register in the equally weighted superposed tation, the function register and ancilla qubit are prepared in state, and the n1-register in the complete mixed state, we the pure state |0. The argument register is in a mixed state have then ⎡ ⎤ N1  with constituent. Each constituent is characterized by N1−1 N2−1 1 ⎣ 1 ⎦ the state of the n1-register. The n2-register in a given con- ρ = |0,j1,j2 . (112) N1 N2 n2 j =0 j =0 stituent is in a superposed state of its N2 =2 basis states. 1 2 d 中国科技论文在线 http://www.paper.edu.cn

268

In this way, we divide the database into N1 sub-databases, just the Liouville space computer Xiao-Long algorithm pro- each with N2 items. Apply the Long algorithm [21] to the posed recently [56]. In Liouville space computation [55], no j ensemble√ with op iterations, where and is approximately superposition of the computational basis states is used. If 1 π N2/4 and β =arcsin√ . In the Long algorithm, each n1 = n − 1 and n2 =1, the algorithm finds the marked item N2 iteration consists of four steps with just two queries. Clearly, the speedup is achieved at the N n expense of more molecules. The number of queries q and 1) apply the query to the whole qubits argument 2 the number of molecules N1 satisfy N × N1 =constant. register, on condition that the query is satisfied, ro- q Suppose we fix the number of molecules in an EQC, N E. tates the phase of the marked state through angle φ = √ π Then in order each constituent is occupied by at least one 2arcsin N2 sin (φ is slightly smaller than n N (4jop +2) molecule, 1 can not be larger than log2 E, otherwise there π); will be constituent without any occupying molecules. We as- n 2) make a Hadamard transformation on the n 2-register; sume that the qubit number n is very large, N E  2 . The

3) make a phase rotation through angle φ on the |0...0 maximum value for n1 is log2 NE. A natural estimate of basis state of the n2-register; the bound is to set NE = NA, the Avogadro constant. This 4) make a Hadamard transformation on the n 2-register sets to n1  79. In principle, we can vary n1 from 0 to

again. log2 NE so that the functioning of the EQC changes. When n N If a sub-database does not contain the marked state, the 1 =0, all E molecules are in the same pure state, the above operation does not produce any effect. The EQC works as a single-quantum-computer. Most NMR EQC quantum computation experiments done so far manage to get constituent that contains the marked item has its n1-register 0 this effect using the effective pure state technique. When in state |j1 . The Long algorithm transforms its n2-register n from the equally weighted superposed state into a single state 1 =1, the ensemble is divided into two sub-ensembles 0 0 0 each with NE/2 molecules. Each sub-ensemble works as a |j2  so that the constituent is in the marked state |j1 j2 .At the end of the Long algorithm, one makes a further query single quantum computer. The whole ensemble works as two n N and on condition that the query is satisfied, makes a flip on single-quantum-computers in parallel. When 1 =log2 E, N the function register. The density matrix becomes the ensemble works as E single-quantum-computers work-    ing in parallel. N2−1 ρf =(1/N1)|00| j =j0 j =0 1/N2|j1j2 1 1 2 d In the above discussion, a single molecule and an en-   N2−1 0 0 0 0 semble of many molecules in pure state are all treated as × j =0 1/N2j1j2| +(1/N1)|11||j1 j2 j1 j2 |. 2 d a single-quantum-computer. We point here that the EQC can N Finally, measuring the ancilla qubit, one obtains 1 tran- do more by implementing the parallel operation proposed in sition peaks in the spectrum, each from a constituent. For Refs. [59, 60]. In these work, the Grover algorithm is run on those constituents without the marked item, each peak is up- some k identical quantum computers in parallel. It is equiva- ward and its transition frequency is random in one of those lent to repeating the algorithm in a single-quantum-computer |j  ··· |j N −  corresponding to states 10 , , 1 2 1 . The constituent k times. We call this parallel algorithm as repetition paral- with the marked item is in a unique state and produces a lel algorithm (RPA). For instance, in Ref. [59], by running downward peak with definite frequency corresponding to the one iteration of Grover’s algorithm on k number of identi- |j0j0 state 1 2 .Itfinds the marked state√ with certainty. cal quantum computers simultaneously and then measuring π N / π N/N / The number of√ queries is about 2 4= 1 4. these quantum computers simultaneously, the marked state / N This is only 1 1 of that a standard Grover algorithm can be found by picking out the one most quantum comput- N requires. This is because there are 1 single-quantum- ers output. Because the marked state will appear 9k/N times computers searching in parallel, each in a reduced database in the outcome, whereas any other state appears k/N times. N/N N π N/N / with only 1 = 2 items. It requires 1 4 steps When k = O(N log N), the probability that the marked state for each single- quantum-computer to complete the search. occurs more than any other state approaches unity. In Ref. n In one extreme 1 =0√, there is only a single molecule, the [60], k identical quantum computers are searching in par- π N/ number of query is 4, which is just that for the stan- allel. In each quantum computer, the probability for find- n n dard Grover algorithm. On the other extreme, if 1 = , ing marked state is amplified. Because there are k quantum n N n 2 =0, the EQC contains =2 molecules in com- computers, by using the majority-vote rule, one needs less pletely mixed state, only a single query is needed. This is iterations on each quantum computer. The speedup scales as 中国科技论文在线 http://www.paper.edu.cn

269 √ O( k). The extent of speedup is the same as the PQC al- 2-qubit system in optical approach [73]. gorithm. But there are several differences between the PQC Phase matching in quantum searching has been experi- and the RPA: 1) in the PQC, the database for each quantum mentally demonstrated in NMR in a two-qubit case [74]. It computer is reduced from N to N/N1, whereas in repetition has been experimentally verified in optical approach by the parallelism, the database size is always N; 2) in the PQC, Spreeuw group [75]. some n1 qubits are in mixed state, whereas in the RPA, all Parallel quantum searching algorithms have also been qubits are in pure states. This gives the PQC the advantage demonstrated in NMR system. The Bruschweiler algorithm to make a fuller use of qubit resources; 3) the PQC algo- have been experimentally demonstrated in NMR systems rithm is of full success rate whereas the RPA is probabilis- with three qubits with improvements in Refs. [76, 77]. In the tic. To overcome fluctuation, it requires more resource than extreme case where the number of items is equal to the num- that in the PQC. For instance, for single query searching, the ber of quantum computers, the marked states can be sought PQC algorithm requires N molecules whereas the algorithm with only a single query by the Xiao-Long algorithm [56]. in Ref. [59] requires O(N log N) molecules. This has been demonstrated in a 7-qubit NMR quantum sys- In reality, some number, say Ns, of molecules has to tem [58]. be used as a logical molecule. A logical molecule can be We have reviewed unsorted database search algorithm in viewed as the minimum number of molecules that acts as a quantum computer. First we introduce the Grover algorithm. single-quantum-computer. Then a molecule in the preceding Then we make a clear distinction between a quantum engine discussion should be understood as a logical molecule. The and a quantum database. We review the different generaliza- number of logical molecules in an EQC is NE/Ns. In prac- tions of the Grover algorithm. In particular, we review the tice, an NMR EQC contains a large number of molecules, phase matching conditions in quantum search algorithm, the say 1016. Though with effective pure state technique, the SO(3) picture of the quantum search algorithm. In particu- number of molecules contributing to quantum computation lar we review the Long algorithm in which unsorted database is reduced, there are still 1010. This is much more than that is found with certainty. We review the quantum amplitude needed for a logical molecule. Thus in ensemble quantum amplification. The quantum search algorithm in a newly pro- computation with effective pure state technique, it is possi- posed duality computer. Finally we point out some misun- ble to see the effect of repetition parallelism. Indeed, it has derstanding about quantum search algorithms. been pointed out that in ensemble quantum computation, un- sorted database search can be faster than Grover algorithm Acknowledgements This work was supported by the National Natural [61] by trading space resources with time resources, a reflec- Science Foundation of China(Grant No. 10325521), the National Ba- tion of the repetition parallelism. In implementing the PQC, sic Research Programe of China (2006CB921106), the Specialized Re- search Fund for the Doctoral Program of Education Ministry of China (No. effective pure state technique can also be used to prepare the 20060003048). n2 + m +1qubits in pure state. Use of classical parallelism to speed up quantum algo- rithms have attracted much attention recently [62–67].

1. Brassard G. Searching a quantum phone book. Science, 1997, 275(5300): 627–628 2. Brassard G, Hoyer P. An exact quantum polynomial-time algorithm Unsorted database search is important in science and tech- for Simon’s problem. In: Proceedings of 35th Annual Symposium on nology. It serves as a benchmark algorithm for demonstrat- the Foundations of Computer Sciences. 1997, 116–123 ing the power of quantum computers. It is a full quantum 3. Brassard G, Hoyer P, Tapp A. Quantum counting. Lecture Notes in mechanical algorithm, while relatively easy to implement. , 1998, 1443: 820–831 It has been realized in nuclear magnetic resonance (NMR) 4. Benioff P. Space searches with a quantum robot. In: Quantum com- putation and information. Washington DC: AMS Series on Contem- quantum systems in two qubits [68, 69]. This is perhaps the porary Mathematics, 2000, 305: 1–12. See also in e-print quant- first quantum algorithm ever been implemented. Later it was /0003006 implemented in NMR with three qubits [70]. Generalized 5. Twamley J J. A hidden shift quantum algorithm. J. Phys. A, 2000, 33: Grover algorithm has also been realized in 2-qubit NMR sys- 8973–8979 tem [71, 72]. It also been experimentally demonstrated in a 6. Guo H, Long G L, Sun Y. A quantum Algorithm for Finding a Hamil- 中国科技论文在线 http://www.paper.edu.cn

270

ton Circuit. Commun. Theor. Phys., 2001, 35(4): 385–388 26. Biron D, Biham O, Biham E, et al. Generalized Grover search al- 7. Guo H, Long G L, Li F. Quantum algorithms for some well-known NP gorithm for arbitrary initial amplitude distribution. Lecture Notes in problems. Commun. Theor. Phys. 2002, 37(4): 424–426 Computer Science, 1999, 1509: 140–147. See also in e-print quart- 8. Yao A C, Bentley J. An almost optimal algorithm for unbounded ph/9801066 searching. Information Processing Letters, 1976, 5: 82–87 27. Shang B. Query complexity for searching multiple marked states from 9. Yao A C, Yao F F. The complexity of searching an ordered random an unsorted database. Commun. Theor. Phys, 2007, 48(2): 264–266. table. In: Proceedings of 17th IEEE Symposium on Foundations of See also in e-print quart-ph/0604059 Computer Science. Houston, Texas: 1976, 222–227 28. Biron E, Biham O, Biron D, et al. Analysis of generalized Grover 10. Shor P W. Algorithms for quantum computation: discrete logarithms quantum search algorithms using recursion equations. Phys. Rev. A, and factoring. In: Proceedings of the Symposium on the Foundations 2001, 63(1): 012310 of computer Science. New York: IEEE Computer Society Press, 1994, 29. Zalka C. A Grover-based quantum search of optimal order for an un- 124–134 known number of marked elements. e-print quart-ph/9902049 11. Grover L K. A fast quantum mechanical algorithm for database search. 30. Han Q Z, Sun H Z. Group theory. Beijing: Peking University Press, In: Proceedings of 28th Annual ACM Symposium on Theory of Com- 1987 puting. New York: ACM, 1996, 212–219 31. Long G L, Sun Y. Efficient scheme for initializing a quantum register 12. Grover L K. Quantum mechanics helps in searching for a needle in a with an arbitrary superposed state. Phys. Rev. A, 2001, 64(1): 014303 haystack. Phys. Rev. Lett., 1997, 79(2): 325–328 32. Hoyer P. Arbitrary phases in quantum amplitude amplification. Phys. 13. Deutsch D, Jozsa R. Rapid Solution of Problems by Quantum Com- Rev. A, 2000, 62(5): 052304 putation. Proc. R. Soc. London A, 1992, 439(1907): 553–558 33. Long G L, Li Y S, Zhang W L, et al. Dominant gate imperfection 14. Sun X M, Yao A C, Zhang S Y. Graph properties and circular func- in Grover’s quantum search algorithm. Phys. Rev. A, 2000, 61(4): tions: how can quantum query complexity go? In: Proceedings 042305 of 19th IEEE Conference on Computational Complexity. Amherst, 34. Niwa J, Matsumoto K, Imai H. General-purpose parallel simulator for Massachusetts: 2004, 286–293 quantum computing. Phys. Rev. A, 2002, 66(6): 062317 15. Sun X M, Yao A C. On the quantum query complexity of local search 35. Shenvi N, Brown K R, Whaley K B. Effects of a random noisy oracle in two and three dimensions. In: Proceedings of 47th Annual IEEE on search algorithm complexity. Phys. Rev. A, 2003, 68(5): 052313 Symposium on Foundations of Computer Science. Berkeley, CA: 36. Li D F, Li X X, Huang H T, et al. Invariants of Grovers algorithm and 2006, 429–438 the rotation in space, Phys. Rev. A, 2002, 66(4): 044304 16. Shi Y Y. Lower bounds of quantum black-box complexity and degree 37. Li D F, Li X X. More general quantum search algorithm Q = of approximating polynomials by influence of Boolean variables. In- −IγV IτU and the precise formula for the amplitude and the non- formation Processing Letters, 2000, 75(1-2):79–83 symmetric effects of different rotating angles. Phys. Rev. A, 2001, 17. Hoyer P, Neerbek J, Shi Y Y.Quantum complexities of ordered search- 287:304–316 ing, sorting, and element distinctness. Algorithmica, 2002, 34(4): 38. Wu X D, Long G L. Verifier-based algorithm for unsorted database 429–448 search problem. Int. J. Quant. Inf. (to appear) 18. Long G L, Zhang W L, Li Y S, et al. Arbitrary phase rotation of the 39. Chi D P, Kim J. Quantum database search with certainty by a single marked state can not be used for Grover’s quantum search algorithm. query. Chaos Solitons Fractals, 1999, 10: 1689–1693. See also in Commun. Theor. Phys., 1999, 32(3): 335–338 e-print quant-ph/9708005 19. Long G L, Li Y S, Zhang W L, et al. Phase matching in quantum 40. Long G L. General quantum interference principle and duality com- searching. Phys. Lett. A, 1999, 262: 27–34 puter. Commun. Theor. Phys., 2006, 45(5): 825–844 20.LongGL,TuCC,LiYS,etal.AnS0(3) picture for quantum 41. Gudder S. Mathematical theory of duality quantum computers. Quan- searching. Journal of Physics A, 2001, 34: 861–866. See also in e- tum Information Processing, 2007, 6(1): 49–54 print quant-ph/9911004 42. Long G L. Mathematical theory of duality computer in the density 21. Long G L. Grover algorithm with zero theoretical failure rate. Phys. matrix formalism. Processing, 2007, 6(1): 37– Rev. A, 2002, 64(2): 022307 48 22. Grover L K. Quantum computers can search rapidly by using almost 43. Deutsch D. Quantum computational networks. Proc. R. Soc. Lond. any transformation. Phys. Rev. Lett., 1998, 80(19): 4330–4332 A, 1989, 425: 73–90 23. Boyer M, Brassard G, Hoyer P, et al. Tight bounds on quantum search- 44. Barenco A, Bennett C H, Cleve R, et al. Elementary gates for quantum ing. In: Proceedings of the Fourth Workshop on Physics and Compu- computation. Phys. Rev. A, 1996, 52(5): 3457–3467 tation. New England: Complex Systems Institute, 1996, 36–43. See 45. Gudder S. Duality quantum computers and quantum operations. Uni- also in e-print quant-ph/9605034 versity of Denver, 2006, M06/11 24. Brassard G, Hoyer P, Mosca M, et al. Quantum amplitude amplifica- 46. Grover L K. Fixed-point quantum search. Phys. Rev. Lett., 2005, tion and estimation. AMS Contemporary Mathematics Series, eds. S. 95(15): 150501 J. Lomonaco and H. E. Brandt, AMS(Providence), 2002, 305: 53–84. 47. Li D F, Li X R, Huang H T, et al. Fixed-point quantum search for See also in e-print quant-ph/0005055 different phase shifts. Phys. Lett. A 2007, 362 (4): 260–264 25. Long G L, Xiao L and Sun Y. Phase matching condition for quantum 48. Long G L and Liu Y.Duality mode and recycling computing in a quan- search with a generalized quantum database. Phys. Lett. A, 2002, tum computer. to be submitted 294: 143–152. See also in e-print quant-ph/0107013 49. Wang W Y, Shang B, Wang C, et al. Prime factorization in the duality 中国科技论文在线 http://www.paper.edu.cn

271

computer. Commun. Theor.Phys., 2007, 47(3): 471–473 tended Bruschweiler bulk-ensemble database search. Phys. Rev. A 50. Bennett C H, Bernstein E, Brassard G, et al. Strengths and weaknesses 2006, 73 (6): 062332 of quantum computing. SIAM J. Comput., 1997, 26(5): 1510–1523 65. Mehring M, Muller K, Averbukh I S, et al. NMR experiment factors 51. Guo H, Long G L, Sun Y.Effects of imperfect gate operations in Shor’s numbers with Gauss sums. Phys. Rev. Lett. 2007, 98 (12): 120502 prime factorization algorithm. J. Chin. Chem. Soc., 2001, 48(4): 449– 66. Pang C Y, Zhou Z W, Guo G C. A hybrid quantum encoding algorithm 454 of vector quantization for . Chinese Physics, 2006, 52. Wei L F, Li Xiao, Hu X D, et al. Effects of dynamical phases in Shor’s 15 (12): 3039–3043 factoring algorithm with operational delays. Phys. Rev. A, 2005, 67. Chen C Y, Hsueh C C. Quantum factorization algorithm by NMR en- 71(3): 022317 semble computers. Applied Mathematics and Computation, 2006, 174 53. Zhirov O V, Shepelyansky D L. Dissipative decoherence in the Grover (2): 1363–1369 algorithm. Eur. Phys. J. D, 2006, 38(2): 405–408 68. Jones J A, Mosca M, Hansen R H. Implementation of a quantum 54. Ai Q, Li Y S, Long G L. Influence of gate operation errors in the search algorithm on a quantum computer. Nature, 1998, 393(6683): quantum counting algorithm. J. Comput. Sci. and Technol., 2006(6), 344–346 21: 927–932 69. Chuang I L, Gershenfeld N, Kubinec M. Experimental implementation 55. Bruschweiler R. Novel strategy for database searching in Liou- of fast quantum searching. Phys. Rev. Lett., 1998, 80(15): 3408–3411 ville space by NMR ensemble computing. Phys. Rev. Lett., 2000, 70. Vandersypen L M K, Steffen M, Sherwood M H, et al. Implementation 85(22): 4815–4818 of a three-quantum-bit search algorithm. Appl. Phys. Lett., 2000, 56. Xiao L, Long G L. Fetching marked items from an unsorted database 76(5): 646–648 using NMR ensemble computing. Phys. Rev. A, 2002, 66(5): 052320 71. Zhang J F, Lu Z H, Deng Z W, et al. NMR analogue of the general- 57. Long G L, Xiao L. Parallel quantum computing in a single ensemble ized Grovers algorithm of multiple marked states and its application. quantum computer. Phys. Rev. A, 2004, 69(6): 052303 Chinese Physics, 2003, 12(7): 700–707 58. Long G L, Xiao L. Experimental realization of a fetching algorithm 72. Zhang J F, Lu Z H, Shan L, et al. Synthesizing NMR analogs of in a 7-qubit NMR Liouville space computer. J. Chem. Phys., 2003, Einstein-Podolsky-Rosen states using the generalized Grover’s algo- 119(16): 8473–8481 rithm. Phys. Rev. A, 2002, 66(4): 044308 59. Grover L K. Quantum computers can search arbitrarily large databases 73. Kwiat P G, Mitchell J R, Schwindt P D D, et al. Grover’s search by a single query. Phys. Rev. Lett., 1997, 79(23): 4709–4712 algorithm: an optical approach. J. Mod. Optics, 2000, 47(2-3): 257– 60. Gingrich R M, Williams C P and Cerf N J. Generalized quantum 266 search with parallelism. Phys. Rev. A, 2000, 61(5): 052313 74. Long G L, Yan H Y, Li Y S, et al. Experimental NMR realization of a 61. Collins D. Modified Grover’s algorithm for an expectation-value quan- generalized quantum search algorithm. Phys. Lett. A, 2001, 286(2-3): tum computer. Phys. Rev. A, 2002, 65(5): 052321 121–126 62. Protopopescu V, D’Helon C, Barhen J, Constant-time solution to the 75. Bhattacharya N, van den Heuvell HBV, Spreeuw RJC. Implementation global optimization problem using Bruschweiler’s ensemble search al- of quantum search algorithm using classical . Phys. Rev. gorithm. Journal of Physics A-Mathematical and General 2003, 36 Lett., 2002, 88(13): 137901 (24): L399–L407 76. Xiao L, Long G L, Yan H Y, et al. Experimental realization of the 63. Hsueh C C, Chen C Y, Constant-time solution to database searching Bruschweiler’s algorithm in a homonuclear system. J. Chem. Phys., by NMR ensemble computing. Fortschritte der Physik-Progress of 2002, 117(7): 3310–3315 Physics 2006, 54 (7): 519–524 77. Yang X D, Wei D X, Luo J, et al. Modification and realization of 64. SaiToh A, Kitagawa M, Matrix-product-state simulation of an ex- Bruschweiler’s search. Phys. Rev. A, 2002, 66(4): 042305