CControlled Quantum Search
K. de Lacy and L. Noakes , J. Twamley , and J.B. Wang School of Mathematics and Statistics, University of Western Australia, WA 6009, Perth, Australia ARC Centre for Engineered Quantum Systems, Department ofPhysics and Astronomy, Macquarie University, NSW 2109, Australia School of Physics and Astrophysics, University of Western Australia, WA 6009, Perth, Australia
Quantum searching for one of N marked items in an unsorted database of n items is solvedin O ( (cid:112) n/N ) steps using Grover’s algorithm. Using nonlinear quantum dynamics with a Gross-Pitaevskii type quadratic nonlinearity, Childs and Young discovered an unstructured quantum searchalgorithm with a complexity O (min { /g log( gn ) , √ n } ), which can be used to find a marked itemafter o (log( n )) repetitions, where g is the nonlinearity strength [1]. In this work we develop astructured search on a complete graph using a time dependent nonlinearity which obtains oneof the N marked items with certainty. The protocol has runtime O (( N ⊥ − N ) / ( G √ NN ⊥ )) if N ⊥ > N , where N ⊥ denotes the number of unmarked items and G is related to the time dependentnonlinearity. If N ⊥ ≤ N , we obtain a runtime O (1). We also extend the analysis to a quantumsearch on general symmetric graphs and can greatly simplify the resulting equations when the graphdiameter is less than 5. I. INTRODUCTION
Using linear quantum mechanics the search problemcan be solved using Grover’s algorithm [2] in O ( (cid:112) n/N )steps, where n denotes the number of search items and N denotes the number of marked items. Grover’s searchis asymptotically optimal in the linear quantum domain[3].The linearity of quantum mechanics plays a subtle butprofound role in the design and performance of quan-tum algorithms. It was shown by Abrams and Lloyd [4]that nonlinear quantum mechanics has the potential tosolve NP-complete (nondeterministic polynomial time)and P problems (including oracle problems) in polyno-mial time.Meyer and Wong [5], and Kahou and Fedor [6] lookedat using the Gross-Pitaevskii dynamics of interactingBose Einstein condensates to perform Grover’s searchand found a runtime which scales as O (min { (cid:112) n/g, √ n } ),where g denotes the nonlinearity strength. Meyer andWong then considered the more general type of nonlin-earity ∼ f ( (cid:107) φ (cid:107) ), where f : R → R is smooth [7]. Morerecently Childs and Young [1], found a nonlinear proto-col with a runtime scaling as O (min { /g log( gn ); √ n } ),which is exponentially faster than previous results [5].Furthermore this nonlinear search can be repeatedo(log( n )) times to find the position of a marked item.In all these works however, the marking of the item | j ∗ (cid:105) ,is performed via the linear part of the dynamics througha term in the Hamiltonian ∼ −| j ∗ (cid:105)(cid:104) j ∗ | . In our work weconsider the case where the marking is encoded into thedegree of the nonlinearity and the nonlinearity itself ofeach item. We consider the case of quantum nonlineardynamics on a complete graph of n sites where the ini-tial site is a uniform superposition up to a phase on themarked site, namely | φ ( t = 0) (cid:105) = i (cid:80) j = i ∗ | j (cid:105) + (cid:80) j (cid:54) = i ∗ | j (cid:105) ,ignoring normalisation, where i ∗ denotes marked items.We apply a time dependent modulation of the nonlin- ear strength u k ( t ) to the k ’th state. Although we use amodel where both the nonlinear strength and the nonlin-earity may depend upon the state, only one is required todepend explicitly upon the states without impacting theend time. This implies our protocol will have the sameruntime when governed by linear or nonlinear quantummechanics. Hence for N (cid:28) n we obtain the same com-plexity as Grover, which is asymptotically optimal in thelinear case.We show analytically that with a suitable form for thenonlinearity strength of the k ’th item, u k ( t ), the proto-col yields complete localisation of the quantum dynamicsonto the marked states in time O (( N ⊥ − N ) / ( G √ N N ⊥ )),for N ⊥ > N and time O (1) when N ⊥ ≤ N . The non-linearity of marked and unmarked items is algebraicallyrelated to G in section III.We interpret the database search problem as a searchon a graph governed by continuous time quantum dy-namics, arriving at the Discrete Nonlinear Schr¨odingerEquation (DNLSE). By expressing the coefficients of eachstate in polar form we can decompose quantum statesover the nodes in the graph into equivalence classes de-pending on the connectivity of the nodes representing un-marked and marked items. For the case of the completegraph this reduction greatly simplifies the description ofthe dynamics. On this graph we are able to develop anew continuous time algorithm which obtains a markeditem with certainty. Furthermore, the error associatedwith measurement becomes arbitrarily small, unlike theprevious work by Meyer and Wong [5] where the peakprobability becomes increasingly difficult to obtain. II. DISCRETE NONLINEAR SCHR ¨ODINGEREQUATION
Index the N marked states by i ∗ and let the coeffi-cient of state j ∈ { , ..., n − } be x j = r j e i θ j , where a r X i v : . [ qu a n t - ph ] D ec r j : [0 , t f ] → [0 , θ j : [0 , t f ] → ( − π, π ], t f ∈ R + and i = √−
1. Let the norm be the natural norm overthe complex numbers, (cid:107) V (cid:107) := V ¯ V , where the bar de-notes conjugation and V ∈ C . The norm squared ofthe i ’th state’s coefficient, r i , is the probability of mea-suring state i . Therefore performing the search equatesto evolving the system to maximise r i ∗ . The dynamicsof the coefficients are governed by the discrete nonlinearSchr¨odinger equation (DNLSE)i ˙ x j = γ L jk x k + u j (cid:107) x j (cid:107) ζ j x j , (1)where γ = G/ ( n − N ) for some constant G . Using x j = r j e i θ j and splitting equation (1) into its real andimaginary components gives˙ r j = γ L jk r k sin( θ k − θ j ) , (2)˙ θ j = − γ L jk r k r j cos( θ k − θ j ) − u j r ζ j j , (3)where the index k is summed from 0 to n − j ’th state is u j : [0 , t f ] → R and ζ j ∈ Z respectively. We assume that both of these canbe manipulated at will and require at least one of ζ j and u j to be different for marked and unmarked states. Fur-thermore we will induce conditions onto ζ j and u j withrespect to j so the graph symmetry is preserved in theDNLSE.The Laplacian, L, for an arbitrary graph is formed bytaking the graph’s adjacency matrix and subtracting thenumber of connections of the j ’th node from the j ’thelement along the diagonal. The number L ij denotes theelement in the i ’th row and j ’th column of the Laplacian.Initially all states are prepared with coefficients r j =1 / √ n for all j ∈ { , ..., n − } and θ i = θ j or θ j ∗ + π/ i , where j and j ∗ indicate unmarked and markedstates respectively. This initial state can be preparedusing a controlled rotation on an equal superposition witha linear quantum computer using O (log( n )) elementaryquantum gates.On a general graph, finding the optimal control curves u j to maximise r i ∗ results in a boundary value problem.We provide a direct numerical method to solve this andfor diameter 3 and 4 graphs, the boundary value problemcan be turned into an initial value problem. For completegraphs we obtain analytic expressions for the controls andend time. Theorem 1.
The DNLSE must conserve the probabilityof measuring any state, hence n (cid:88) j =1 r j = 1 , (4) when normalised.Proof. Take the derivative of the left hand side of (4) withrespect to time and substitute equation (2). To remain physical, the graph must be undirected so L jk = L kj .Hence, n (cid:88) j =1 r j ˙ r j = n (cid:88) j,k =1 γ L jk r k r j sin( θ k − θ j ) = 0 . (5)Integrating this gives equation (4) under the assumptionthat the system is normalised. REDUCING THE DNLSE VIA GRAPHSYMMETRY
A reduction based upon symmetry can be performedto simplify the DNLSE. Let all n nodes of the graphform the set denoted by N . The set N is isomorphic tothe set of states labelled by { , , ..., n − } . The bijectivemapping φ : N → { , , ..., n − } uniquely identifies eachnode with a state.The distance d ( a, b ) between two nodes a, b ∈ N isthe minimum number of edges in any path connecting a to b . Two nodes a, b ∈ N are said to be equivalent, a ∼ b , if φ ( a ) and φ ( b ) are labels for both marked or bothunmarked states, and there exist elements c , c ∈ [ e ],where d ( a, c ) = d ( b, c ) for all e ∈ N . Furthermore theset [ e ], for e ∈ N is defined as [ e ] := { c ∈ N | c ∼ e } , called the equivalence class of e . When all nodes in eachequivalence class are given the same nonlinearity, then for a, b ∈ [ e ], with e ∈ N , the coefficients of states labelled by φ ( a ) and φ ( b ) are equal. Hence, the DNSE can be writtenusing coefficients of one state from each equivalence classunder the mapping φ . Call the process of writing anequation in terms of single elements of equivalence classesa reduction. III. COMPLETE GRAPH
A complete graph is a graph with every node connectedto every other by a unique edge. On a complete graph anystate can be directly transformed into any other, hencethis is the least restrictive graph possible. To preservethe symmetry of a complete graph, let all marked stateshave the same nonlinearity, ζ ∗ , and all unmarked stateshave the same nonlinearity, ζ , where ζ ∗ = ζ is allowed.For the complete graph, there are only two equivalenceclasses under our equivalence relation, namely the set ofnodes corresponding to marked states and the set of allnodes corresponding to unmarked states. Therefore thereduction process results in a single node representing amarked state, connected to a single node representing anunmarked state.If N = n there is certainty of measuring a markedstate. For N < n marked states, the reduction can bewritten in terms of the constraints: r i = r j , θ i = θ j where i and j index marked states, and r i = r j , θ i = θ j where i and j index unmarked states. The Laplacian foran undirected, complete graph of n nodes is,L = − n . . .
11 1 − n . . .
11 1 1 − n . . . . . . − n . (6)Simplifying the DNLSE in equations (2) and (3) by per-forming a reduction gives˙ r ∗ = γ ( n − N ) r sin( θ − θ ∗ ) , ˙ r = γN r ∗ sin( θ ∗ − θ ) , ˙ θ ∗ = − γ ( N − n + ( n − N ) rr ∗ cos( θ − θ ∗ )) − u ∗ r ζ ∗ ∗ , ˙ θ = − γN (cid:16) r ∗ r cos( θ ∗ − θ ) + 1 (cid:17) − ur ζ , where r and θ describe the radial and angular compo-nents of the coefficient of any unmarked state and r ∗ and θ ∗ denote the radial and angular components of the co-efficient of any marked state. Similarly all controls forthe marked states are denoted u and all controls for theunmarked states are u ∗ . CONTROLLED QUANTUM SEARCH ON ACOMPLETE GRAPH
Theorem 1 states that the total probability is con-served, which can be rearranged to give r = (cid:114) − N r ∗ n − N . (7)Therefore the DNLSE can be written without r . OnlyΘ = θ − θ ∗ is found in the equation for ˙ r ∗ , not θ ∗ and θ separately. Hence the states can be contracted˙ r ∗ = gn − N ( n − N ) r sin(Θ) , (8)˙Θ = gn − N (( n − N ) rr ∗ − N r ∗ r ) cos(Θ) − g − ur ζ + u ∗ r ζ ∗ ∗ . (9)The desired dynamics is for r ∗ to increase as quickly aspossible. Therefore the magnitude of r sin(Θ) should bemaximised, hence sin(Θ) = 1 ≡ Θ = π/ C π , where C can be set to zero without loss of generality. Theinitial state, constructed earlier, satisfies this optimalityconstraint. However, to remain optimal we require Θ = π/ u ∗ r ζ ∗ ∗ − ur ζ = g , (10)where the radial components are known explicitly byequations (7) and (11). The differential equation for the radial component is ˙ r ∗ = ( n − N ) r . Integrating this andusing the initial condition r ∗ (0) = 1 / √ n gives r ∗ = 1 √ N sin (cid:32) g (cid:112) N ( n − N ) tn − N + sin − (cid:32)(cid:114) Nn (cid:33)(cid:33) . (11)The accumulated probability of all marked states is N r ∗ .The shape of this curve is the square of a sine function. InMeyer and Wong’s work [5] on solving structured searchproblems via nonlinear quantum mechanics, they obtainpeaks which become arbitrarily narrow, and therefore ar-bitrarily difficult to measure. In our scheme, the abilityto measure a marked item with certainty becomes easieras n increases because the neighbourhood about N r ∗ = 1becomes flatter. Hence the error associated with mea-surement is essentially negligible for large n . Two plots ofthe accumulated probability in figure 1 depict the proba-bility of measuring a marked state as a function of time,for n = 3 and n = 10, with one marked state and g = 1. t N r * Probability for n = (a) t N r * Probability for n = (b) FIG. 1: Each subfigure depicts the probability of mea-suring a marked state
N r ∗ with respect to time, where r ∗ is determined by equation (11). Both subfigures have g = 1, N = 1 but varying n . This variation changes theend time and causes the curve to become flatter aroundthe maximum, hence measurement of the maximum in-curs less error as n increases.The terminal condition reads 0 = ˙ r ∗ ( t f ) r ∗ ( t f ). Aswe seek a maximum this condition becomes 0 = ˙ r ∗ ( t f ),solving this for t f provides t f = n − Ng cos − (cid:16)(cid:113) Nn (cid:17)(cid:112) N ( n − N ) = O (cid:18) n − Ng (cid:112) N ( n − N ) (cid:19) , (12)using the big-O convention [8]. Note that the maximalitycondition 0 = ˙ r ∗ ( t f ) is equivalent to r ( t f ) = 0, whichimplies that there is zero probability of measuring anunmarked node at time t f .When N ⊥ ≤ N additional unmarked nodes can be im-plemented so the number of unmarked and marked nodesis equal. However, this assumes we know the exact num-ber of marked nodes. In this case it is optimal to set thecontrols to zero, returning to linear quantum mechanics.The complexity in this case is the same as Grover’s searchand the expected time classically, namely O (1) [9].On a complete graph we have proven the nonlinearities ζ and ζ ∗ affect the control and not the optimal conver-gence rate. Hence these can be chosen to simplify thecontrol. Note that the nonlinearity is not an integral partof the protocol on a complete graph, hence if ζ = ζ ∗ = 0we obtain a linear search algorithm with the same con-vergence rate.Define the error E := 1 − N r ∗ ( t f ) as the probability ofmeasuring an unmarked state at time t f given by equa-tion (12). We assume this error only results from theinability to reconstruct the control perfectly in a physi-cal system. Given N = 1 and ζ ∗ = ζ = 0, then we couldchoose controls u = 0 and u ∗ = g . Then assume the con-trol functions are simulated to error ν and ν ∗ such that, u = ν and u ∗ = g + ν ∗ for constant ν ∗ , ν ∈ R . Then theerror decreases as the number of states increases as perfigure 2. n E Error vs. n
FIG. 2: The error at time t f as a function of the totalnumber of states. It is assumed the control is incorrectlysimulated such that ν ∗ = ν = 0 .
5. The simulation hasone marked state and n − SYMMETRIC GRAPHS
Let there be one marked state, N = 1, and considerany symmetric graph S . More precisely, S is edge andvertex transitive. Let d ∈ N be an integer denoting thediameter of the graph.Call the set of nodes with distance i to the node repre-senting the marked state the i ’th shell. Give every nodein the same shell the same nonlinearity. The graph S canbe fully described by:1. Its diameter d .2. The number of edges from a node on one shell tothe next. The number of edges for a node on shell i to shell i +1 is denoted c i , where i = 0 , , , ..., d − i ’th shellhas n i nodes, where i = 0 , , , ..., d . The index0 denotes the node representing the marked state,hence n = 1.There are particular relations between these parametersand they cannot be chosen arbitrarily. Furthermore thenumber of connections from a node in disk i +1 to one ondisk i is c i n i /n i +1 . The value c denotes the number ofedges all other nodes must have to ensure the symmetryis preserved. Therefore the number of edges from a nodeon the i ’th shell to other nodes on the i ’th shell is c − c i − n i − /n i − c i . Upon performing a reduction, each shellforms an equivalence class. Hence the reduction resultsin one node from each shell. Let i denote the index of anode in the i ’th shell. Then the DNLSE reads˙ r = γc r sin( θ − θ )˙ r j = γ (cid:18) c j − n j − n j r j − sin( θ j − − θ j ) + c j r j +1 sin( θ j +1 − θ j ) (cid:19) ˙ r d = γ c d − n d − n d r d − sin( θ d − − θ d )˙ θ = γ (cid:18) c − c r r cos( θ − θ ) (cid:19) − u r ζ ˙ θ j = γ (cid:18) − c j − n j − n j r j − r j cos( θ j − − θ j ) − (cid:0) − c j − n j − n j − c j (cid:1) − c j r j +1 r j cos( θ j +1 − θ j ) (cid:19) − u j r ζ j j ˙ θ d = γ (cid:18) − c d − n d − n d r d − r d cos( θ d − − θ d ) − (cid:0) − c d − n d − n d − c d (cid:1)(cid:19) − u d r ζ d d , for j = 1 , , ..., d −
1. These equations are rather nasty,however, there are no summations and the number of dif-ferential equations has been reduced from 2 n to 2( d + 1).To maximise the probability of measuring the 0’th state,choose the control to maximise the PMP Hamiltonian H = λ j (cid:16) γ c j − n j − n j r j − sin( θ j − − θ j ) (cid:17) + γ Λ j (cid:16) − c j − n j − n j r j − r j cos( θ j − − θ j ) − (cid:16) − c j − n j − n j − c j (cid:17) − c j r j +1 r j cos( θ j +1 − θ j ) − u j γ r ζ j j (cid:17) , where r d +1 = 0, c − = 0 and j is summed from 0 to n − − ˙ λ x γ = 1 γ ∂ H ∂r x = λ x +1 (cid:16) c x n x n x +1 sin( θ x − θ x +1 ) (cid:17) + Λ x +1 (cid:16) − c x n x n x +1 r x +1 cos( θ x − θ x +1 ) (cid:17) + Λ x (cid:16) c x − n x − n x r x − r x cos( θ x − − θ x ) (cid:17) + Λ x − (cid:16) − c x − r x − cos( θ x − θ x − ) (cid:1) + Λ x (cid:16) c x r x +1 r x cos( θ x +1 − θ x ) (cid:1) + Λ x (cid:16) − ζ x u x γ r ζ x − x (cid:17) , and − ˙Λ x γ = ∂ H ∂θ x = − λ x (cid:16) c x − n x − n x r x − cos( θ x − − θ x ) (cid:17) + λ x +1 (cid:16) c x n x n x +1 r x cos( θ x − θ x +1 ) (cid:17) + Λ x (cid:16) − c x − n x − n x r x − r x sin( θ x − − θ x ) (cid:17) + Λ x +1 (cid:16) c x n x n x +1 r x r x +1 sin( θ x − θ x +1 ) (cid:17) + Λ x (cid:16) − c x r x +1 r x sin( θ x +1 − θ x ) (cid:17) + Λ x − (cid:16) c x − r x r x − sin( θ x − θ x − ) (cid:17) . The optimality condition isΛ i r ζ i i = 0 , (13)where i is summed from 0 to d . This provides a singlepiece of information. Theorem 2.
The sum over costates of θ is zero, n (cid:88) i =1 Λ i = 0 . (14) Proof.
The derivative of the left hand side of equation (14) is − n (cid:88) i =1 ˙Λ i = (cid:0) λ j r i − λ i r j (cid:1) L ji cos( θ j − θ i )+ (cid:16) Λ j r i r j + Λ i r j r i (cid:17) L ji sin( θ i − θ j )= 0 . Integrating this and substituting the transversality con-ditions for Λ i gives equation (14).With the equation from Theorem 2 and its derivative,along with the extrema condition, three costates can befound as functions of the other costates and states as longas the conditions are independent. Furthermore, only thedifference in phase between adjacent shells are impor-tant, this can be used to eliminate one state. Further-more these new conditions can be differentiated to find anadditional four conditions on the costates. If these con-ditions are independent the costates can be determinedin terms of the states and control when d = 2 or 3. Inthese cases, the control can be written in terms of thestates and costates, hence the boundary value differen-tial equations becomes initial value differential equationswhich can be solved using a feedback loop. This can bedone using a classical computer and there is a significantamount of research aimed at developing techniques tosolve forward differential equations using feedback loopsin quantum computation [10–13].When d ≥
4, we obtain a boundary value differentialequation. This can be solved numerically. When the ra-dial component of an unmarked state becomes zero, thephase loses all meaning and the derivative of the phasecan easily grow to infinity. To avoid this, Cartesian co-ordinates are used to find a numerical solution. Further-more a small amount of error when forward solving theDNLSE will grow extremely rapidly. To reduce this ef-fect we use an adaptive step-size, Runge-Kutta (RadauIIA) method. The nonlinearity can be optimised usinga discrete optimiser. The control is constructed from acubic B-spline.FIG. 3: An illustration of the circular graph with 6 nodes.Consider the circular graph of six nodes in figure 3.Performing a reduction, this becomes the four node sys-tem defined by˙ r = 2 γr sin( θ − θ )˙ r = γr sin( θ − θ ) + γr sin( θ − θ )˙ r = γr sin( θ − θ ) + γr sin( θ − θ )˙ r = 2 γr sin( θ − θ )˙ θ = 2 γ − γ r r cos( θ − θ ) − ur ζ ˙ θ = − γ r r cos( θ − θ ) + 2 γ − γ r r cos( θ − θ ) − u r ζ ˙ θ = − γ r r cos( θ − θ ) + 2 γ − γ r r cos( θ − θ ) − u r ζ ˙ θ = − γ r r cos( θ − θ ) + 3 γ − u r ζ . For convenience we use a nonlinearity ζ ∗ = 1 on theunmarked states and ζ = 2 on the marked state. Thecontrol is described by a finite number of elements byusing a cubic B-spline with 5 control points. The con-trol points are forced to have magnitude less than 20 toensure the magnitude of the control is always less than20. In practice this bound would be replaced with thephysical limitations of the apparatus.Only the phase differences are important so set θ (0) =0, the remaining initial phases are parameters to be cho-sen by the numerical optimisation. The solution withthe highest probability takes a total time of 7 .
70 seconds and converges with a probability of 0 .
98 to measure themarked state.After 1 .
43 seconds the first peak of r , has a heightof 0 .
95. This solution is far more practical because itconverges almost eight times quicker than the previoussolution.
SUMMARY
When the entanglement of a quantum system is repre-sented by the DNLSE with a complete graph, we deter-mine an explicit algorithm to determine the optimal timedependent nonlinearity. The resulting search protocolhas runtime O (( N ⊥ − N ) / ( g √ N N ⊥ )) for N ⊥ > N andfor N ⊥ ≤ N , the runtime is O (1). This protocol scalesequally with Grover’s search and can be implemented ona linear or nonlinear quantum computer. Furthermoreas the number of states increase the error resulting frommeasurement decreases.For a symmetric graph with diameter two or threethe resulting boundary value problem can be reducedto an initial value problem. However, for larger diam-eters, maximising the probability of marked states be-comes more complex as it is no longer optimal to setthe phase difference between nodes to π/
2. We developa direct numerical package to maximise the probabilityof the marked states subject to the discrete nonlinearSchr¨odinger equation and initial conditions. [1] A. M. Childs and J. Young, Phys. Rev. A , 022314(2016).[2] L. K. Grover, Physical review letters , 325 (1997).[3] C. H. Bennett, E. Bernstein, G. Brassard, and U. Vazi-rani, SIAM journal on Computing , 1510 (1997).[4] D. S. Abrams and S. Lloyd, Physical Review Letters ,3992 (1998).[5] D. A. Meyer and T. G. Wong, New Journal of Physics , 063014 (2013).[6] M. E. Kahou and D. L. Feder, Physical Review A ,032310 (2013). [7] D. A. Meyer and T. G. Wong, Physical Review A ,012312 (2014).[8] D. E. Knuth, ACM Sigact News , 18 (1976).[9] A. Tulsi, (2016).[10] R. J. Nelson, Y. Weinstein, D. Cory, and S. Lloyd, Phys.Rev. Lett. , 3045 (2000).[11] S. Lloyd, Phys. Rev. A , 022108 (2000).[12] A. L. Grimsmo, Physical review letters , 060402(2015).[13] S. Wang and M. R. James, Automatica52