quant-ph0408045/t.tex
1: %\documentclass[10pt,twocolumn]{article}
2: \documentclass[12pt]{article}
3: \usepackage{amsmath}
4: \usepackage{amsfonts}
5: \usepackage{epsfig}
6: 
7: % Parameters for A4 paper
8: \setlength{\textheight}{237mm}   %  297mm - 50mm
9: \setlength{\textwidth}{160mm}    %  210mm - 50mm
10: \setlength{\topmargin}{0mm}
11: \setlength{\headheight}{0mm}
12: \setlength{\headsep}{0mm}
13: \setlength{\evensidemargin}{0mm}
14: \setlength{\oddsidemargin}{0mm}
15: \setlength{\footskip}{10mm}
16: \setlength{\parindent}{0mm}
17: \setlength{\parskip}{1.5mm}
18: 
19: \def\tr{{\rm tr}}
20: \newcommand{\set}[1]{{\mathbb{#1}}}
21: %\renewcommand{\cite}[1]{[#1]}
22: 
23: \begin{document}
24: 
25: \title{Efficient state preparation for a register of quantum bits}
26: \author{
27: Andrei N. Soklakov and R\"udiger Schack\\
28: \\
29: {\it Department of Mathematics, Royal Holloway,
30:        University of London,}\\
31: {\it Egham, Surrey TW20 0EX, United Kingdom}}
32: 
33: \date{11 March 2005}
34: 
35: \maketitle
36: 
37: 
38: \begin{abstract}
39: We describe a quantum algorithm to prepare an arbitrary pure state of a
40: register of a quantum computer with fidelity arbitrarily close to
41: 1. Our algorithm is based on Grover's quantum search algorithm. 
42: For sequences of states with suitably bounded amplitudes, the algorithm 
43: requires resources that are polynomial in the number of qubits.
44: Such sequences of states occur naturally in the problem of encoding a
45: classical probability distribution in a quantum register.
46: \end{abstract}
47: 
48: \section{Introduction}
49: 
50: In many applications of quantum computers, a quantum register, composed of a
51: fixed number of qubits, is initially prepared in some simple standard state.
52: This initial preparation step is followed by a sequence of quantum gate
53: operations and measurements. There are applications of quantum computers, however,
54: notably the task of simulating the dynamics of a physical system
55:  \cite{Lloyd1996,Zalka1998,Somaroo1999}, that may require the
56: initialization of a quantum register in a more general state, corresponding to
57: the initial physical state of the simulated system. This leads naturally to
58: the question of what quantum states can be efficiently prepared on a quantum
59: register.
60: 
61: The memory of a classical computer can be easily put into any state by writing
62: an arbitrary bit string into it.  The situation for quantum computers is very
63: different. The Hilbert space associated with a quantum register composed of as
64: few as 100 quantum bits (qubits) is so large that it is impossible to give a
65: classical description of a generic state vector, i.e., to list the $2^{100}$
66: complex coefficients defining it. In this sense it can be said that arbitrary
67: pure states cannot be prepared \cite{Percival1992}.
68: 
69: It is nevertheless possible to formulate the problem of arbitrary state
70: preparation for a register of qubits in a meaningful way. This is achieved by
71: starting from the assumption that the state is initially defined by a set of
72: quantum {\em oracles}. By assuming that the state is given in this form, we
73: shift the focus from the problem of describing the state to the problem of the
74: computational resources needed to actually prepare it. In other words, we
75: address the computational complexity rather than the algorithmic complexity of
76: the state. For the purpose of quantifying these computational resources, we
77: simply count the number of oracle calls. We are thereby deliberately ignoring
78: the internal structure of the oracles and the computational resources needed 
79: in each oracle call.
80: The algorithm we describe here is applicable to any set of oracles, i.e., to
81: any state. We will show that it is {\em efficient\/} for a large class of
82: states of particular interest for the simulation of physical systems.
83: 
84: Let $N$ be a positive integer. 
85: We will describe a quantum algorithm for preparing a $\lceil \log_2
86: N\rceil$-qubit quantum register in an approximation to the state
87: \begin{equation}  \label{eq:Psi}
88: |\Psi\rangle = \sum_{x=0}^{N-1} \sqrt{p(x)} \, e^{2\pi i \phi(x)} |x\rangle
89: \end{equation}
90: for arbitrary probabilities $p(x)$ and arbitrary phases $\phi(x)$. Here
91: and throughout the paper,
92: $|0\rangle, |1\rangle,\ldots$ denote computational basis states. 
93: More precisely, given any small positive numbers $\lambda$ and $\nu$, our
94: algorithm prepares the quantum register in a state $|\tilde\Psi\rangle$
95: such that, with probability greater than $1-\nu$, the fidelity obeys the bound
96: \begin{equation}    \label{eq:fidelityBound}
97: |\langle\tilde\Psi|\Psi\rangle| > 1-\lambda \;.
98: \end{equation}
99: 
100: To define the algorithm and to assess its efficiency for large $N$, we need to
101: specify in which form the coefficients $p(x)$ and $\phi(x)$ are given.  We
102: assume that we are given classical algorithms to compute the functions $p(x)$
103: and $\phi(x)$ for any $x$. These classical algorithms are used to
104: construct a set of quantum {\em oracles}. We will  quantify the resources
105: needed by our state preparation algorithm in terms of (i) the number of oracle
106: calls, (ii) the number of additional gate operations, and (iii) the number of
107: auxiliary qubits needed in addition to the $\lceil \log_2 N\rceil$ register
108: qubits. 
109: 
110: To analyze the asymptotic, large $N$, behavior of our algorithm, we consider a
111: sequence of probability functions $p_N:\{0,\ldots,N-1\}\to[0,1]$,
112: $\sum_xp_N(x)=1$, and a sequence of
113: phase functions $\phi_N:\{0,\ldots,N-1\}\to[0,1]$, where
114: $N=1,2,\ldots$. For any $N$, the algorithm prepares the quantum register in a
115: state $|\tilde\Psi\rangle$ such that, with probability greater than $1-\nu$,
116: the fidelity obeys the bound (\ref{eq:fidelityBound}), where in the
117: definition~(\ref{eq:Psi}) of $|\Psi\rangle$ the functions $p$ and $\phi$ are
118: replaced by $p_N$ and $\phi_N$, respectively. Under the assumption that there
119: exists a real number $\eta$, $0<\eta<1$, such that 
120: \begin{equation}    \label{eq:etaBound}
121: p_N(x)\le{1\over\eta N} \;\;\mbox{ for all }\;\; N \;\mbox{ and }\; x \;,
122: \end{equation}
123: we show that the resources needed by our
124: state preparation algorithm are polynomial in the number of qubits, $\log_2N$,
125: and the inverse parameters $\eta^{-1}$, $\lambda^{-1}$ and $\nu^{-1}$.
126: 
127: An obvious example of a sequence of functions that do not satisfy the
128: bound~(\ref{eq:etaBound}) and for which the resources required
129: for state preparation scale exponentially with the number of qubits is given
130: by $p_N(x)=\delta_{xy}$ for some integer $y=y(N)$. In
131: this case, it follows {from} the optimality of Grover's algorithm
132: \cite{Grover1997,Boyer1998} 
133: that the number of oracle calls needed is proportional to $\sqrt{N}$.
134: 
135: Sequences that do satisfy the bound~(\ref{eq:etaBound}) arise naturally in the
136: problem of encoding a bounded probability density function
137: $f:[0,1]\to[0,f_{\rm max}]$ in a state of the form 
138: \begin{equation}  
139: |\Psi_f\rangle = {\cal N}^{-1} \sum_{x=0}^{N-1} \sqrt{f(x/N)}\,|x\rangle \;,
140: \end{equation}
141: where ${\cal N}$ is a normalization factor. Grover and Rudolph have given an
142: efficient algorithm for this problem if the function $f$ is efficiently
143: integrable \cite{Grover-0208}. Essentially the same algorithm was found
144: independently by Kaye and Mosca \cite{Kaye2001}, who also mention that phase
145: factors can be introduced using the methods discussed in
146: Ref.~\cite{Cleve1998}.  Recently, Rudolph \cite{Rudolph-unpublished} has found
147: a simple nondeterministic state-preparation algorithm that is efficient for
148: all sequences satisfying the bound~(\ref{eq:etaBound}). 
149: 
150: For general sequences of states satisfying the bound (\ref{eq:etaBound}),
151: a given value of the fidelity bound $\lambda$,
152: and assuming polynomial resources for the oracles, our
153: algorithm is exponentially more efficient than the algorithm proposed by
154: Ventura and Martinez \cite{Ventura1999} and later related proposals
155: \cite{Long2001b,Andrecut2001}, for which the resources needed grow like
156: $N\log_2N$. The use of Grover's algorithm for state preparation has been
157: suggested by Zeng and Kuang for a special class of coherent states in the
158: context of ion-trap quantum computers \cite{Zeng2000c}. A general analysis of
159: the state preparation problem in the context of adiabatic quantum computation
160: was given by Aharonov and Ta-Shma \cite{Aharonov-0301}.
161: 
162: This paper is organized as follows.  In Sec.~\ref{sec:Algorithm}
163: we give a full description of our algorithm.  A detailed derivation is
164: deferred to Sec.~\ref{sec:derivation}.  The algorithm depends on a number of
165: parameters that can be freely chosen. In Sec.~\ref{sec:fidelity} we
166: consider a particular choice for these parameters and show that it guarantees
167: the fidelity bound~(\ref{eq:fidelityBound}).  We use the same choice of
168: parameters in Sec.~\ref{sec:resources} to derive worst case bounds on the
169: time and the memory resources required by the algorithm. In
170: Sec.~\ref{sec:conclusions} we conclude with a brief summary.
171: 
172: \section{Algorithm}\label{sec:Algorithm}
173: 
174: Our algorithm consists of two main stages. 
175: In the first stage, the algorithm prepares the
176: register in an approximation to the state 
177: \begin{equation}    \label{eq:PsiP}
178: |\Psi_{p}\rangle =
179:   \sum_{x=0}^{N-1} \sqrt{p(x)} \, |x\rangle \;,
180: \end{equation}
181: which differs {from} $|\Psi\rangle$ only in the phases $\phi(x)$. More
182: precisely, let $\epsilon$ be the largest small parameter such that
183: \begin{equation}    \label{eq:epsilonBound}
184: \epsilon<\lambda\eta/3
185: \end{equation}
186: and $1/\epsilon$ is an integer.  
187: The first stage of the algorithm  prepares 
188: the register in a state
189: \begin{equation}    \label{eq:PsiPtilde}
190: |\Psi_{\tilde p}\rangle =
191:   \sum_{x=0}^{N-1} \sqrt{\tilde p(x)} \, |x\rangle \;,
192: \end{equation}
193: such that, with probability greater than $1-\nu$, we 
194: have that
195: \begin{equation} \label{TheFidelityBound}
196: |\langle\Psi_{\tilde p}|\Psi_p\rangle| > 1-\lambda \;.
197: \end{equation}
198: We will describe the details of the first stage below.
199: 
200: The second stage of the algorithm adds the phases $\phi(x)$ 
201: to the state $|\Psi_{\tilde
202:   p}\rangle$ resulting {from} the first stage. 
203: This can be done in a straightforward way as follows.
204: We start by choosing a small parameter $\epsilon'$ such that
205: $1/\epsilon'$ is a positive integer. We then define a list of unitary
206: operations, $U_1,\ldots,U_{1/\epsilon'}$, on our quantum register by
207: \begin{equation} \label{eq:Uk}
208: U_k|x\rangle=\left\{
209:            \begin{array}{ll}
210: e^{2\pi i \epsilon'}|x\rangle     
211:                  & \mbox{ if}\ \ \phi(x) > (k-{1\over2})\epsilon' \;,\cr
212:                     |x\rangle & \mbox{ otherwise}.
213:                    \end{array}
214:      \right.
215: \end{equation}
216: The operators $U_k$ are conditional phase shifts that can be realized as
217: quantum gate sequences using the classical algorithm for computing the
218: function $\phi(x)$ \cite{Cleve1998}.  If we apply the operators $U_k$
219: sequentially to the result of the first stage, we obtain
220: \begin{equation}
221: |\tilde\Psi\rangle  =  U_1U_2\cdots U_{1/\epsilon'}|\Psi_{\tilde p}\rangle 
222: = \sum_{x=0}^{N-1} \sqrt{\tilde p(x)} \, e^{2\pi i \tilde\phi(x)} |x\rangle \;,
223: \end{equation}
224: where the function $\tilde\phi(x)$ satisfies the inequality
225: \begin{equation}   \label{eq:tildePhiBound}
226:    |\tilde\phi(x) - \phi(x)| \le\epsilon'/2
227:  \end{equation}
228: for all $x$. It can be shown (see section~\ref{sec:stage2Fidelity})
229: that
230: together with Eq.~(\ref{TheFidelityBound})
231: this implies the bound
232: \begin{equation}   \label{eq:properFidelityBound}
233: |\langle\tilde\Psi|\Psi\rangle| > 1-\lambda-\lambda' \;,
234: \end{equation}
235: where $\lambda'={\epsilon'}^2/8$. Notice the slight abuse of notation 
236: identifying the parameter $\lambda$ in the
237: inequality~(\ref{eq:fidelityBound}) with the sum $\lambda+\lambda'$ in the
238: inequality~(\ref{eq:properFidelityBound}). 
239: 
240: We now proceed to a more detailed description of the first stage of the
241: algorithm. 
242: {From} now on we assume that $N$ is an integer power of 2. This can always be 
243: achieved by padding the function $p(x)$ with zeros. 
244: Given our choice of the parameter $\epsilon$, Eq.~(\ref{eq:epsilonBound}), we define a list of {\em
245:   oracles}, $o_1,\ldots,o_{1/\epsilon}$, by
246: \begin{equation} \label{eq:ok}
247: o_k(x)=\left\{
248:            \begin{array}{ll}
249:         1  & \mbox{ if } \sqrt{p(x)} \ge (1-\epsilon k)/\sqrt{\eta N} \;,\cr
250:         0  & \mbox{ otherwise}.
251:                    \end{array}
252:      \right.
253: \end{equation}
254: We extend this definition beyond the domain of the function $p$ by setting 
255: $o_k(x)=0$ for $x\ge N$. 
256: Using the classical algorithm to compute $p(x)$, one can construct quantum
257: circuits implementing the unitary oracles 
258: \begin{equation} \label{eq:okHat}
259: \hat o_k|x\rangle = (-1)^{o_k(x)}|x\rangle \;.
260: \end{equation}
261: These circuits are efficient if the classical algorithm is efficient.
262: The list of oracles $o_k$ defines a new function $p'(x)$ via
263: \begin{equation} \label{eq:pPrime}
264: \sqrt{p'(x)}= (1-\epsilon k)/\sqrt{\eta N} 
265: \;\;\mbox{if}\;\; 
266: o_{k-1}(x)=0 \;\;\mbox{and}\;\;
267: o_{k}(x)=1 \;,
268: \end{equation}
269: where $o_0(x)=0$ by convention.
270: The situation is illustrated in Fig.~\ref{figure1}, where the $x$ values have
271: been permuted for clarity. Knowledge of this permutation is not required for
272: our algorithm.
273: 
274: \begin{figure}
275: %\epsfig{file=pictures/p.eps,width=7.7cm}
276: %\epsfig{file=pictures/p.eps,width=12cm}
277: \epsfig{file=fig1.eps,width=12cm}
278: \caption{(Color online)
279:   The solid line shows an example for a function $\sqrt{p(x)}$,
280:   sketched versus a permutation, $\Pi(x)$, chosen so that $p(\Pi^{-1}(x)) \le
281:   p(\Pi^{-1}(y))$ if $x>y$. The dotted and dashed lines show the corresponding
282:   functions $\sqrt{p'(x)}$ and $\sqrt{p''(x)}$ [see Eqs.~(\ref{eq:pPrime})
283:   and~(\ref{eq:pDoublePrime})], which in this representation look like
284:   decreasing step functions. In this example, $1/\epsilon=7$, $T=4$, and 
285:   it is assumed that $\tilde
286:   n_4<\tilde n_3$ due to counting errors. Notice that the function $p(x)$
287:   is not required to be decreasing.}
288: \label{figure1}
289: \end{figure}
290: 
291: The essence of the first stage of the algorithm consists in using a number of
292: Grover iterations based on the oracles $\hat o_k$ to prepare the 
293: register in an approximation to the state
294: \begin{equation}  \label{eq:PsiPrime}
295: |\Psi_{p'}\rangle = {\cal N'}^{-1}\sum_{x=0}^{N-1} \sqrt{p'(x)} |x\rangle \;,
296: \end{equation}
297: where the normalization factor ${\cal N'}$ reflects the fact that
298: $p'(x)$ may not be normalized. To find the number of required 
299: Grover iterations for each oracle $\hat o_k$, 
300: we need an estimate of the number of
301: solutions, $n_k$, for each oracle, defined by
302: \begin{equation}  \label{eq:nk}
303: n_k = \sum_{x=0}^{N-1} o_k(x) \;.
304: \end{equation}
305: This estimate can be obtained {from} running the quantum counting 
306: algorithm \cite{Boyer1998} for each oracle $\hat o_k$. 
307: We denote the estimates obtained in this way by $\tilde n_k$.
308: The accuracy of the estimate $\tilde{n}_k$ relative
309: to $n_k$ can be characterized by two real parameters,
310: $0<\nu<1$ and $0<\eta_c<1/2$, in such a way that, as a result of quantum counting,
311: with probability greater than $1-\nu$ we have
312: \begin{equation}
313: |\tilde{n}_k-n_k|<\eta_c N \;\;\mbox{for}\;\;k=1,\ldots,1/\epsilon\;.
314: \end{equation}
315: For each oracle, $\hat{o}_k$, the resources needed to 
316: achieve the counting accuracy specified by $\eta_c$ and $\nu$ 
317: depend on the actual number of solutions $n_k$.
318: This dependence is important for optimizing the performance
319: of our algorithm. In this paper, however, we 
320: present a simpler analysis
321: assuming worst case conditions for each oracle $\hat{o}_k$.
322: For this analysis we use a specific choice of $\eta_c$,
323: which is given
324: by Eq.~(\ref{eq:worstCase}).
325: 
326: The analysis of the algorithm is simplified if we concentrate on
327: a subset of oracles,
328: \begin{equation}
329: O_k = o_{f_k} \;\mbox{ for }\; k=1,\ldots,T\;,
330: \end{equation}
331: where $T$ and the indices $f_1,\ldots,f_T$ are determined by the construction
332: below.  We introduce a new parameter $\eta_g$ (see Eq.~(\ref{eq:worstCase}) below) 
333: such that $\eta_c<\eta_g<1/2$.
334: The index $f_1$ is defined to  be the smallest integer such that
335: \begin{equation}    \label{eq:ignorePeak}
336: \tilde n_{f_1}\ge\eta_gN \;\mbox{ and }\; 
337: \tilde n_j<\eta_gN \;\mbox{ for }\; j<f_1 \;,
338: \end{equation}
339: and, for $k\ge2$, the index $f_k$ is the smallest integer such that 
340: \begin{equation}    \label{eq:increasing}
341:  \tilde n_{f_{k-1}} < \tilde n_{f_{k}} \;\mbox{ and }\; 
342:   f_{k-1} < f_{k} < {1/\epsilon}  \;.
343: \end{equation}
344: The number $T$ is the largest value of $k$ for which these inequalities can be
345: satisfied. 
346: The effect of Eq.~(\ref{eq:ignorePeak}) is to neglect narrow peaks
347: (corresponding to small values of $\Pi(x)$ in Fig.~\ref{figure1}).
348: Equation~(\ref{eq:increasing}) makes sure that the numbers $\tilde n_{f_k}$
349: form an increasing sequence even if, due to counting errors, the estimates
350: $\tilde n_k$ do not (see Fig.~\ref{figure1}).
351: 
352: For $k=1,\ldots,T$, define $\tilde{N}_k=\tilde{n}_{f_k}$,
353: \begin{equation}  \label{eq:defineNk}
354: N_k=\sum_{x=0}^{N-1}O_k(x)\,,
355: \end{equation}
356: and 
357: \begin{equation} \label{deltas}
358: \delta_k=\epsilon(f_{k+1}-f_{k})/\sqrt{\eta N}\;,
359: \end{equation}
360: where we define $f_{T+1}=1/\epsilon$. 
361: For every oracle $O_k$, the value of $\tilde N_k$ is an
362: approximation to the number of solutions, $N_k$, satisfying the bound
363: \begin{equation}
364: |\tilde{N}_k-N_k|=|\tilde{n}_{f_k}-n_{f_k}|<\eta_cN\,.
365: \end{equation}
366: 
367: In what follows it will be convenient to introduce the notation
368: \begin{equation}   \label{eq:Bsk}
369: B_{s,k}=\sum_{j=s}^{k}\delta_j\,.
370: \end{equation}
371: The oracles $O_k$ define a new function $p''(x)$ via
372: \begin{equation} \label{eq:pDoublePrime}
373: \sqrt{p''(x)}= B_{k,T}\;\;
374:     \mbox{if}\;\; O_{k-1}(x)=0 \;\;\mbox{and}\;\;O_{k}(x)=1\,,
375: \end{equation}
376: where $O_0(x)=0$ by convention.
377: The function $\sqrt{p''(\Pi^{-1}(x))}$ is a decreasing step
378: function, with step sizes $\delta_1,\ldots,\delta_T$ which are multiples of
379: $\epsilon/\sqrt{\eta N}$. The widths of the steps are given by the numbers
380: $N_k$ which are determined by the oracles (see Fig.~\ref{figure1}).
381: 
382: The algorithm can now be completely described as follows. 
383: Choose a suitable (small) number, $a$, of {\em auxiliary qubits\/} 
384: (see Eq.~(\ref{eq:worstCase}) below), and define
385: $L=\log_2 N +a$. For $k=1,\ldots,T$, find the quantities
386: \begin{equation}   \label{eq:alpha_k}
387: \tilde\alpha_k^2 =
388: \frac{\displaystyle\Big(\sum_{s=1}^{k-1}\tilde N_s\delta_s\Big)^2
389: +\tilde N_k\Big(1-\sum_{s=1}^{k-1}(\tilde N_s-\tilde N_{s-1})B_{s,k-1}^2\Big)
390: }{\tilde N_k(2^aN-\tilde N_k)}\,,
391: \end{equation}
392: \begin{equation}   \label{eq:gamma_fin_and_ini}
393: \tilde\gamma^{\rm fin}_k=
394: \frac{\sum_{s=1}^{k}\tilde N_s\delta_s}{\tilde\alpha_k\sqrt{2^aN\tilde{N}_k}}
395:              \ \ \ {\rm and} \ \ \ 
396: \tilde\gamma^{\rm ini}_k=
397: \frac{\sum_{s=1}^{k-1}\tilde N_s\delta_s}
398:         {\tilde\alpha_k\sqrt{2^aN\tilde{N}_k}}\,,
399: \end{equation}
400: \begin{equation}   \label{eq:omega_k}
401: \tilde{\omega}_k=\arccos\Big(1-\frac{2\tilde{N}_k}{2^aN}\Big)\,,
402: \end{equation}
403: and
404: \begin{equation}    \label{eq:t_k}
405: t_k = \Big\lfloor {1\over2} + 
406: {1\over\tilde\omega_k}
407: (\arcsin\tilde\gamma^{\rm fin}_k - \arcsin\tilde\gamma^{\rm ini}_k )
408: \Big\rfloor \,.
409: \end{equation}
410: For $k=1,\ldots,T$, define the  Grover operator
411: \begin{equation}
412: \hat G(O_k,t_k)
413:   =\left((2|\Psi^0\rangle\langle\Psi^0|-\hat I)\hat O_k\right)^{t_k}\,,
414: \end{equation}
415: where  
416: \begin{equation}  \label{eq:Psi0}
417:   |\Psi^0\rangle=(2^aN)^{-1/2}\sum_{x=0}^{2^aN-1}|x\rangle \,,
418: \end{equation}
419: $\hat I$ is the $L$-qubit identity operator, $\hat
420: O_k|x\rangle = (-1)^{O_k(x)}|x\rangle$, and where the domain of the oracles
421: $O_k$ is extended to the range $0\le x<2^aN$ by setting $O_k(x)=0$ if $x\ge
422: N$.
423: 
424: Prepare a register of $L$ qubits in the state $|\Psi^0\rangle$,
425: then apply the Grover operators successively to create the state
426: \begin{equation} \label{eq:psiT}
427: |\Psi^T\rangle = \hat{G}(O_T,t_T)\cdots\hat{G}(O_1,t_1) |\Psi^0\rangle \;.
428: \end{equation}
429: Now measure the $a$ auxiliary qubits in the computational basis.
430: If all $a$ outcomes are $0$ this stage of the algorithm 
431: is successfully prepares the desired state Eq.~(\ref{eq:PsiPtilde}).
432: 
433: If one of the measurements of the auxiliary qubits 
434: returns 1, this stage of the algorithm has failed, and one has to start
435: again by preparing the register in the state $|\Psi^0\rangle$ as in
436: Eq.~(\ref{eq:Psi0}). Assuming the choice of parameters in
437: Eq.~(\ref{eq:worstCase}), the probability, $p_{\rm fail}$, that the
438: algorithm fails in this way satisfies the bound 
439: $p_{\rm fail}<10\lambda$ (see Eq.~(\ref{TheFailureProbability})). 
440: 
441: Before we provide detailed proofs of the above claims
442: it is helpful to give a hint of how this stage of the
443: algorithm achieves its goal. The algorithm aims
444: at constructing the function $\sqrt{\tilde p(x)}$ 
445: which is close to the function $\sqrt{p''(x)}$ 
446: defined in Eq.~(\ref{eq:pDoublePrime}).  
447: The sequence of Grover operators in
448: Eq.~(\ref{eq:psiT}) creates a step function
449: that is close to $\sqrt{p''(\Pi^{-1}(x))}$ (see Fig.~\ref{figure1}).
450: In particular each operator $\hat{G}(O_k,t_k)$ in
451: Eq.~(\ref{eq:psiT}) creates a step with the
452: correct width $N_k$ and a height $h_k$
453: which is close to the target height $\delta_k$.
454: Due to a remarkable property of Grover's 
455: algorithm~\cite{Biham1999}, once the features
456: $h_1,\ldots,h_{k-1}$ have been developed
457: they are not distorted by 
458: $\hat{G}(O_k,t_k)$ which develops $h_k$.
459: In this way the algorithm proceeds building
460: feature after feature until it constructs all
461: $T$ of them. At the end, because of the inherent
462: errors, the auxiliary qubits end up having small amplitudes
463: for nonzero values. Measuring them 
464: projects the auxiliary qubits onto the zero values
465: with a probability that can be made arbitrarily close to 1. 
466: This also slightly changes the features $h_k$
467: due to renormalization of the state after the 
468: measurement, which we take into account when we estimate
469: the overall loss of fidelity.
470: 
471: \section{Derivation of the algorithm}\label{sec:derivation}
472: 
473: In section~\ref{sec:Algorithm} we have already
474: explained the second stage of our algorithm.
475: Here we present a detailed explanation
476: of the first stage. This section is organized
477: as follows. In subsection~\ref{subsecBiham}
478: we review some properties
479: of the Grover operator introducing
480: our notation as we go along.
481: In subsection~\ref{subsecOneStep}
482: we introduce a convenient mathematical
483: form for analyzing intermediate quantum 
484: states visited by the algorithm.  
485: And finally, in subsection~\ref{subsec:t_and_h}
486: we derive the values~(\ref{eq:t_k}) of the times $t_k$ used in our
487: algorithm. 
488: 
489: 
490: \subsection{Preservation of features by the Grover operator}\label{subsecBiham}
491: 
492:   We will be using the following result~\cite{Biham1999}. 
493:   Consider an oracle $O$, which accepts $r$ values of $x$ (out
494:   of the total of $2^aN$, i.e., $\sum_{x=0}^{2^aN-1}O(x)=r$). We shall call
495:   such values of $x$ {\em good}, as opposed to {\em bad\/} values of $x$ that
496:   are rejected by the oracle. Using different notation for the coefficients of
497:   good and bad states, we have that after $t$ Grover iterations an arbitrary
498:   quantum state
499: \begin{equation} \label{initial}
500: |\Psi^{\rm ini}\rangle= \sum_{{\rm good\ }x} g^{\rm ini}_x|x\rangle
501:                            +\sum_{{\rm bad\ }x} b^{\rm ini}_x|x\rangle
502: \end{equation}
503: is transformed into
504: \begin{equation}
505: |\Psi^{\rm fin}\rangle=\hat{G}(O,t)|\Psi^{\rm ini}\rangle
506: =\sum_{{\rm good\ }x} g^{\rm fin}_x|x\rangle
507:                            +\sum_{{\rm bad\ }x} b^{\rm fin}_x|x\rangle.
508: \end{equation}
509: Let $\bar{g}^{\rm ini}$ and $\bar{b}^{\rm ini}$ be the averages of the initial
510: amplitudes of the good and the bad states respectively:
511: \begin{equation}
512: \bar{g}^{\rm ini}
513: =\frac{1}{r}\sum_{{\rm good\ }x}g^{\rm ini}_x\,,\hspace*{2cm}
514: \bar{b}^{\rm ini}=\frac{1}{2^aN-r}\sum_{{\rm bad\ }x}b^{\rm ini}_x\,,
515: \end{equation}
516: and similarly for the final amplitudes
517: \begin{equation}
518: \bar{g}^{\rm fin}
519: =\frac{1}{r}\sum_{{\rm good\ }x}g^{\rm fin}_x\,,\hspace*{2cm}
520: \bar{b}^{\rm fin}=\frac{1}{2^aN-r}\sum_{{\rm bad\ }x}b^{\rm fin}_x\,,
521: \end{equation}
522: Let us also define
523: \begin{equation}
524: \Delta g^{\rm ini}_x= 
525: g^{\rm ini}_x-\bar{g}^{\rm ini}\,,\hspace*{2cm}
526: \Delta b^{\rm ini}_x=b^{\rm ini}_x-\bar{b}^{\rm ini}\,.
527: %\Delta g^{\rm fin}_x= 
528: %g^{\rm fin}_x-\bar{g}^{\rm fin}\,,\ \
529: %\Delta b^{\rm fin}_x=b^{\rm fin}_x-\bar{b}^{\rm fin}\,.
530: \end{equation}
531: In other words, $\Delta g^{\rm ini}_x$ and $\Delta b^{\rm ini}_x$ define the
532: {\em features\/} of the initial amplitude functions $g^{\rm ini}_x$ and
533: $b^{\rm ini}_x$ relative to their averages $\bar{g}^{\rm ini}$ and
534: $\bar{b}^{\rm ini}$.  Biham {\it et.\ al.} have shown that the change of the
535: amplitudes is essentially determined by the change of the averages:
536: \begin{eqnarray} \label{BihamEquations}
537: g^{\rm fin}_x&=&\bar{g}^{\rm fin}+\Delta g^{\rm ini}_x \cr
538: b^{\rm fin}_x&=&\bar{b}^{\rm fin}+(-1)^t\Delta b^{\rm ini}_x\,,
539: \end{eqnarray}
540: where the averages $\bar{g}^{\rm fin}$ 
541: and $\bar{b}^{\rm fin}$ are given as follows. 
542: Define
543: \begin{eqnarray}
544: \omega&=&\arccos\left(1-\frac{2r}{2^{a}N}\right)\;,\cr
545: \alpha
546: &=&\sqrt{|\bar{b}^{\rm ini}|^2+|\bar{g}^{\rm ini}|^2\frac{r}{2^aN-r}}\;,\cr
547: \phi
548: &=&\arctan\left(\frac{\bar{g}^{\rm ini}}{\bar{b}^{\rm ini}}
549:     \sqrt{\frac{r}{2^aN-r}}\,\right)\;.
550: \end{eqnarray} 
551: The averages are given by
552: \begin{eqnarray}
553: \bar{g}^{\rm fin}&=&\sqrt{\frac{2^aN-r}{r}}\;\alpha\,\sin(\omega t+\phi)\,, \cr
554: \bar{b}^{\rm fin}&=&\alpha\,\cos(\omega t+\phi)\,.
555: \end{eqnarray}
556: We shall also use the separations, $\Delta^{\rm ini}$ and
557: $\Delta^{\rm fin}$, of the averages
558: \begin{equation}
559: \Delta^{\rm ini}=\bar{g}^{\rm ini}-\bar{b}^{\rm ini}\,\hspace*{2cm}
560: \Delta^{\rm fin}=\bar{g}^{\rm fin}-\bar{b}^{\rm fin}\,.
561: \end{equation}  
562: Directly {from} the definition we obtain
563: \begin{equation} \label{DeltaT}
564: \Delta^{\rm fin}=\frac{\alpha}{\sqrt{r/(2^aN)}}\sin(\omega t-\xi),
565: \end{equation}
566: where the phase $\xi$ can be found {from} $\Delta^{\rm ini}$,
567: \begin{equation}
568: \xi=-\arcsin\Big{(}
569:     \frac{\Delta^{\rm ini}}{\alpha}\sqrt{\frac{r}{2^aN}}
570:         \Big{)}\,.
571: \end{equation}
572: In our applications we will only need the case when the initial amplitude of
573: the bad states is flat, i.e.\ $\Delta b^{\rm ini}_x=0$. In this case, the
574: amplitude of the bad states always remains flat
575: \begin{equation}
576: b_x^{\rm fin}=\bar{b}^{\rm fin}\,,
577: \end{equation}
578: 
579: This fact and the fact that the initial features, $\Delta g_x^{\rm ini}$, of
580: the amplitude of the good states are preserved,
581: \begin{equation}
582: g_x^{\rm fin}-\bar{g}^{\rm fin}=\Delta g_x^{\rm ini}\,,
583: \end{equation}
584: see~(\ref{BihamEquations}), is crucial for
585: understanding the rest of this paper.
586: 
587: \begin{figure}[here]
588: %\epsfig{file=pictures/SuppInfoBiham.eps,width=15.5cm}
589: \epsfig{file=fig2.eps,width=15.5cm}
590: \caption{(Color online)
591:   Illustration of the action of the Grover operator $\hat G(O,t)$  on an
592:   arbitrary amplitude function $\sqrt{p(x)}$. The light area indicates values
593:   of $x$ that are accepted by $O$ (``good values''), and the dark area
594:   indicates values of $x$ that are  rejected by $O$ (``bad values'').}
595: \label{BihamFigure}
596: \end{figure}
597: 
598: \subsection{Intermediate states}\label{subsecOneStep}
599: 
600: The preparation stage of our algorithm summarized in Eq.~(\ref{eq:psiT}) 
601: gives rise to a sequence of states defined by
602: \begin{equation} \label{eq:psiK}
603: |\Psi^k\rangle = \hat{G}(O_k,t_k) |\Psi^{k-1}\rangle \;.
604: \end{equation}
605: Let $\set{O}_k$ be the set of solutions to the oracle $O_k$:
606: \begin{equation}
607: \set{O}_k=\{x:O_k(x)=1\}\,.
608: \end{equation}
609: For $k=2,\dots,T$, these states can be written in the form
610: \begin{equation}\label{PsiKminusOne}
611: |\Psi^{k}\rangle=
612: A_1^{k}\sum_{x\in\set{O}_1}|x\rangle
613: +A_2^{k}\sum_{x\in\set{O}_2}|x\rangle
614: +\dots+
615: A_{k}^{k}\sum_{x\in\set{O}_k}|x\rangle
616: +B^{k}\sum_{x\not\in\set{O}_k}|x\rangle\,,
617: \end{equation} 
618: where
619: \begin{equation}\label{A_jk}
620: A_j^{k}=B^{k}+\sum_{s=j}^{k}h_s\,.
621: \end{equation}
622: Since $B^{k}$ is real and positive, the value of $B^{k}$ can be determined
623: {from} the normalization condition $\langle\Psi^{k}|\Psi^{k}\rangle=1$.
624: 
625: The action of the algorithm can be visualized as shown in
626: Fig.~\ref{UnfinishedStatePrep}, which shows the result of the first three
627: iterations. The integers $N_k$ [defined in Eq.~(\ref{eq:defineNk})] are the
628: number of good values of $x$ according to oracle $O_k$.  We see that each
629: operation $\hat{G}(O_k,t_k)$ prepares a feature of height
630: $h_k=h_{k}(t_k,N_1,\dots,N_k)$.  It follows {from} the conclusions of
631: section~\ref{subsecBiham} that once such a feature is developed, its height
632: remains constant throughout the computation.
633: 
634: \begin{figure}[here]
635: %\epsfig{file=pictures/UnfinishedStatePrep.eps,width=15.5cm}
636: \epsfig{file=fig3.eps,width=15.5cm}
637: \caption{(Color online)
638: This figure shows the amplitudes for the state, $|\Psi^{3}\rangle$,
639: after three iterations of the algorithm. See the text for details.}
640: \label{UnfinishedStatePrep}
641: \end{figure}
642: 
643: \subsection{Values of $t_k$} \label{subsec:t_and_h}
644: 
645: In this subsection we show how the times $t_k$ are related to the
646: corresponding features $h_k$.
647: 
648: The normalization condition $\langle\Psi^{k}|\Psi^{k}\rangle=1$ reads
649: \begin{equation}
650: N_1(A_1^{k})^2+(N_2-N_1)(A_2^{k})^2
651: +\dots+(N_{k}-N_{k-1})(A_{k}^{k})^2
652: +(2^aN-N_{k})(B^{k})^2=1.
653: \end{equation}
654: Substituting (\ref{A_jk}), this gives us a quadratic
655: equation for $B^{k}$:
656: \begin{equation}
657: 2^aN(B^{k})^2+2\Big(\sum_{s=1}^{k}N_s h_s\Big)B^{k}
658: +\sum_{s=1}^{k}(N_s-N_{s-1})C^2_{s,k}-1=0,
659: \end{equation}
660: where we define $N_0=0$ and
661: \begin{equation}
662: C_{s,k}=\sum_{j=s}^{k}h_j\,.
663: \end{equation}
664: Solving this equation, and using the fact that $B^{k}\geq 0$, we obtain
665: \begin{equation}
666: B^{k}=-\frac{\sum_{s=1}^{k}N_s h_s}{2^aN}
667: +\sqrt{\Big(\frac{\sum_{s=1}^{k}N_s h_s}{2^aN}\Big)^2
668: +\frac{1-\sum_{s=1}^{k}(N_s-N_{s-1})C_{s,k}^2}{2^aN}} \;.
669: \end{equation}
670: This formula together with Eq.~(\ref{A_jk}) provide an explicit expression
671: (\ref{PsiKminusOne}) for $|\Psi^{k}\rangle$ in terms of the numbers
672: $\{N_s\}_{s=1}^{k}$ and $\{h_s\}_{s=1}^{k}$.
673: 
674: To build the $k$th feature, we apply the Grover operator $\hat{G}(O_k,t_k)$ to
675: the state $|\Psi^{k-1}\rangle$.  We will now derive an expression for the
676: integer ``time'' $t_k$ in terms of the features $h_1,\ldots,h_k$ and the
677: widths $N_1,\ldots,N_k$.  Given $|\Psi^{k-1}\rangle$ as an initial state, let
678: us define $\bar{g}^{\rm ini}_k$ and $\bar{b}^{\rm ini}_k$ to be the initial
679: average amplitudes of the good and the bad states according to the oracle~$O_k$:
680: \begin{equation}
681: \bar{b}^{\rm ini}_k=B^{k-1}\,,
682: \end{equation}
683: \begin{align}
684: \bar{g}^{\rm ini}_k&=\frac{1}{N_k}\Big(A_1^{k-1}N_1+A_2^{k-1}(N_2-N_1)
685: +\dots+A_{k-1}^{k-1}(N_{k-1}-N_{k-2})+ B^{k-1}(N_k-N_{k-1}) \Big)\cr
686: &=\frac{\sum_{s=1}^{k-1}N_s h_s}{N_k}+B^{k-1} \;.
687: \end{align}
688: 
689: The initial separation, $\Delta^{\rm ini}_k$, between the good and the bad
690: averages is therefore
691: \begin{equation}\label{Delta0}
692: \Delta^{\rm ini}_k=\bar{g}^{\rm ini}_k-\bar{b}^{\rm ini}_k
693: =\frac{\sum_{s=1}^{k-1}N_s h_s}{N_k}\;.
694: \end{equation}
695: Observe that developing a new feature of height $h_k$ is equivalent to
696: increasing the initial separation $\Delta^{\rm ini}_k$ by $h_k$. The final
697: separation (after $t_k$ steps) between the good and bad averages is therefore
698: \begin{equation} \label{Delta_tk}
699: \Delta^{\rm fin}_k = \Delta^{\rm ini}_k + h_k 
700: = \frac{\sum_{s=1}^{k}N_s h_s}{N_k}\,.
701: \end{equation} 
702: Using (\ref{Delta0}) and (\ref{Delta_tk})
703: together with~(\ref{DeltaT}),
704: we therefore have
705: \begin{equation} \label{ForTk}
706: t_k=\frac{1}{\omega_k}\left(\arcsin\Big(\frac{\Delta^{\rm fin}_k}{\alpha_k}
707:              \sqrt{\frac{N_k}{2^aN}}\Big)
708:                 -\arcsin\Big(\frac{\Delta^{\rm ini}_k}{\alpha_k}
709:              \sqrt{\frac{N_k}{2^aN}}\Big)\right)\,,
710: \end{equation}
711: where
712: \begin{equation} \label{omega_k}
713: \omega_k=\arccos\Big(1-\frac{2N_k}{2^{a}N}\Big)\,,
714: \end{equation}
715: and
716: \begin{eqnarray}  \label{eq:alpha_kSquared}
717: \alpha_k^2&=&(\bar{b}^{\rm ini}_k)^2+\frac{(\bar{g}^{\rm ini}_k)^2 N_k}{2^aN-N_k}\cr
718: &=&\frac{\Big(\sum_{s=1}^{k-1}N_s h_s\Big)^2
719: +N_k\Big(1-\sum_{s=1}^{k-1}(N_s-N_{s-1})C_{s,k-1}^2\Big)
720: }{N_k(2^aN-N_k)}\;.
721: \end{eqnarray}
722: 
723: To achieve a good fidelity between the state $|\Psi_{\tilde p}\rangle$ that we
724: actually prepare and our ``target'' state $|\Psi_{p}\rangle$, we want the
725: features $h_k$ to be as close as possible to the target values $\delta_k$
726: defined in Eq.~(\ref{deltas}). This motivates the
727: formulas~(\ref{eq:alpha_k}--\ref{eq:t_k}) for $t_k$ which are obtained {from}
728: the formulas~(\ref{Delta0}--\ref{eq:alpha_kSquared}) by (i) replacing the
729: features $h_k$ by the targets $\delta_k$, (ii) replacing the widths $N_k$ by
730: the measured values $\tilde N_k$, and (iii) by rounding to the nearest
731: integer.
732: 
733: \section{Fidelity analysis} \label{sec:fidelity}
734: 
735: 
736: In the above description of the algorithm, we have not specified how to choose
737: the parameters $\eta_c$, $\eta_g$ and $a$ as a function of
738: $\epsilon$ (or, alternatively, of the initially given parameters $\lambda$ and
739: $\eta$). The optimal choice for these parameters depends on the estimates
740: $\tilde n_1,\ldots,\tilde n_{1/\epsilon}$ obtained in the quantum counting
741: step. In this section we provide a rather generous 
742: worst case analysis which shows
743: that the choice
744: \begin{equation}   \label{eq:worstCase}
745: \eta_c={\epsilon^5}/{54} \;,\;\; \eta_g=0.99\epsilon^2
746: \;,\;\; a=\lceil \log_2\frac{\eta_g}{\eta_c}-3\rceil
747: \end{equation}
748: guarantees, with probability greater than $1-\nu$, the fidelity bound
749: \begin{equation}   \label{eq:realFidelityBound}
750: |\langle\Psi_{\tilde p}|\Psi_p\rangle| > 1-\lambda \;.
751: \end{equation} 
752: This bound is valid for arbitrary values of the $\tilde n_k$. In most
753: actual applications, much larger values of the accuracy parameters $\epsilon$,
754: $\eta_g$ and $\eta_c$ will be sufficient to guarantee this fidelity  bound.
755: 
756: We now show that Eq.~(\ref{eq:t_k}), for the times $t_k$  which we
757: motivated in the previous section, implies the fidelity
758: bound~(\ref{eq:realFidelityBound})  under the assumption
759: that the parameters $\eta_c$, $\eta_g$ and $a$ are chosen as in
760: Eq.~(\ref{eq:worstCase}). 
761: 
762: Our starting point will be two sets of expressions for the $t_k$, namely the
763: definition of the $t_k$, Eqs.~(\ref{eq:alpha_k}--\ref{eq:t_k}), in terms of
764: the measured values $\tilde N_k$ and the target values $\delta_k$, and
765: Eqs.~(\ref{Delta0}--\ref{eq:alpha_kSquared}) above in terms of the actual
766: values $N_k$ and $h_k$. In subsection~\ref{sec:hk-minus-deltak} we will derive
767: an upper bound on the error $|\delta_k-h_k|$.
768: This bound shows how accurate our algorithm is
769: in achieving the target height, $\delta_k$, for the features $h_k$.
770: The overall accuracy of our algorithm, however, also depends on
771: how accurate it is in achieving the correct width of the features.
772: This accuracy is determined by the
773: fraction of $x$ values for which $p'(x)\neq p''(x)$ (see Figure~\ref{figure1}).
774: In subsection~\ref{sec:exceptions} we obtain an upper bound on this fraction.
775: In subsection~\ref{sec:stage1Fidelity}, we derive the fidelity
776: bound~(\ref{eq:realFidelityBound}) and an upper bound 
777: on the probability that the algorithm fails 
778: due to a nonzero outcome of the measurement of the
779: auxiliary qubits. And finally, in
780: subsection~\ref{sec:stage2Fidelity}, we show that the
781: bound~(\ref{eq:tildePhiBound}) on the phases $\tilde\phi(x)$ implies the
782: overall fidelity bound~(\ref{eq:properFidelityBound}).
783:  
784: \subsection{Bound on $|\delta_k-h_k|$}   \label{sec:hk-minus-deltak}
785: 
786: It is convenient to perform the proof of the bound on 
787: $|\delta_k-h_k|$ in three steps. For this we note that 
788: $t_k$ depend on the values of $\tilde{\gamma}_k^{\rm ini}$, 
789: $\tilde{\gamma}_k^{\rm fin}$ and $\tilde{\omega}_k$.
790: In subsection~\ref{subsec:RangeForGammas} we determine 
791: the range of possible values for $\tilde{\gamma}_k^{\rm ini}$ and 
792: $\tilde{\gamma}_k^{\rm fin}$ that corresponds to the uncertainty
793: in the measured values of $\tilde{N}_k$. Similarly in 
794: subsection~\ref{subsec:RangeForOmegas} we determine the error range
795: for $\tilde{\omega}_k$, and finally, in subsection~\ref{subsec:ProofOfTheBound}
796: we complete the proof of the bound.
797: 
798: \subsubsection{Error range for $\tilde{\gamma}_k^{\rm ini}$ and 
799: $\tilde{\gamma}_k^{\rm fin}$} \label{subsec:RangeForGammas}
800: 
801: Equation~(\ref{ForTk}) provides an explicit expression for $t_k$ in terms of
802: $\{h_k\}$ and $\{N_k\}$:
803: \begin{equation}\label{t_kF1}
804: t_k=F(\{h_s\},\{N_s\})\,.
805: \end{equation}
806: In what follows it will be convenient to 
807: use auxiliary quantities $\{\tau_k\}$ defined as
808: \begin{equation}\label{tau_kF1}
809: \tau_k=F(\{\delta_s\},\{N_s\})\,.
810: \end{equation}
811: The meaning of $\tau_k$ becomes clear in comparison with (\ref{t_kF1}):
812: $\tau_k$ are the time intervals that correspond to the target features
813: $\{\delta_k\}$.  Unlike $\{t_k\}$, $\{\tau_k\}$ are not necessarily integers.
814: 
815: It will be convenient to rewrite the definition of $t_k$ given in
816: Eqs.~(\ref{eq:alpha_k}--\ref{eq:t_k}) in a slightly modified form:
817: \begin{equation}    
818: t_k = \Big\lfloor {1\over2} + 
819: {1\over\tilde\omega_k}
820: (\arcsin\tilde\gamma^{\rm fin}_k - \arcsin\tilde\gamma^{\rm ini}_k )
821: \Big\rfloor\,,
822: \end{equation}
823: where we use the following definitions:
824: \begin{equation} \label{TildeOmega_k}
825: \tilde{\omega}_k=\arccos\Big(1-\frac{2\tilde{N}_k}{2^aN}\Big)\,,
826: \end{equation}
827: \begin{equation}
828: \tilde{\gamma}^{\rm fin}_k=\frac{\tilde{\Delta}^{\rm fin}_k}{\tilde{\alpha}_k}
829:              \sqrt{\frac{\tilde{N}_k}{2^aN}}\,,\ \ \  
830: \tilde{\gamma}^{\rm ini}_k=\frac{\tilde{\Delta}^{\rm ini}_k}{\tilde{\alpha}_k}
831:              \sqrt{\frac{\tilde{N}_k}{2^aN}}\,,
832: \end{equation}
833: \begin{equation}
834: \tilde{\Delta}^{\rm fin}_k=
835: \frac{\sum_{s=1}^{k}\tilde{N}_s \delta_s}{\tilde{N}_k}\,,
836: \ \ \
837: \tilde{\Delta}^{\rm ini}_k
838: =\frac{\sum_{s=1}^{k-1}\tilde{N}_s \delta_s}{\tilde{N}_k}\,,
839: \end{equation}
840: and
841: \begin{equation}
842: \tilde{\alpha}_k^2
843: =\frac{\Big(\sum_{s=1}^{k-1}\tilde{N}_s \delta_s\Big)^2
844: +\tilde{N}_k\Big(1-\sum_{s=1}^{k-1}(\tilde{N}_s-\tilde{N}_{s-1})B_{s,k-1}^2\Big)
845: }{\tilde{N}_k(2^aN-\tilde{N}_k)}\;,
846: \end{equation}
847: where
848: \begin{equation}
849: B_{s,k}=\sum_{j=s}^{k}\delta_j\,.
850: \end{equation}
851: It is also convenient to define
852: \begin{equation}
853: \gamma^{\rm fin}_k=
854: \frac{\sum_{s=1}^{k}N_s\delta_s}{\alpha_k\sqrt{2^aN{N}_k}}
855:              \ \ \ {\rm and} \ \ \ 
856: \gamma^{\rm ini}_k=
857: \frac{\sum_{s=1}^{k-1} N_s\delta_s}{\alpha_k\sqrt{2^aN{N}_k}}\,.
858: \end{equation}
859: In this notation Eq.~(\ref{tau_kF1}) can be rewritten as
860: \begin{equation}
861: \omega_k\tau_k=\arcsin\gamma^{\rm fin}_k 
862: -\arcsin\gamma^{\rm ini}_k\,.
863: \end{equation}
864: 
865: Directly {from} the definitions we have
866: \begin{equation}
867: \Big(\tilde{\gamma}^{\rm fin}_k\Big)^2
868: =\frac{\Big(1-\frac{\tilde{N}_k}{2^aN}\Big)\Big(\sum_{s=1}^{k}\tilde{N}_s\delta_s\Big)^2}{\Big(\sum_{s=1}^{k-1}\tilde{N}_s\delta_s\Big)^2
869: +\tilde{N}_k\Big(1-\sum_{s=1}^{k-1}(\tilde{N}_s-\tilde{N}_{s-1})B_{s,k-1}^2\Big)
870: }\,.
871: \end{equation}
872: By direct calculation we get
873: \begin{eqnarray}
874: \sum_{s=1}^{k-1}(\tilde{N}_s-\tilde{N}_{s-1})B_{s,k-1}^2
875: &=&\sum_{s=1}^{k-1}\tilde{N}_s\Big(\delta_s^2
876: +2\delta_s\sum_{j=s+1}^k\delta_j\Big)
877: +\tilde{N}_{k-1}\delta_k^2\cr
878: &=&\sum_{s=1}^{k-1}N_s\Big(1\pm\eta_c\frac{N}{N_s}\Big)\Big(\delta_s^
879: +2\delta_s\sum_{j=s+1}^k\delta_j\Big)
880: +N_{k-1}\Big(1\pm\eta_c\frac{N}{N_{k-1}}\Big)\delta_k^2 \;. \cr 
881: &&
882: \end{eqnarray}
883: The $\pm$ notation is an abbreviation for a double inequality (see the
884: appendix). Since $N_s\geq(\eta_g-\eta_c)N$ we obtain
885: \begin{equation}
886: \sum_{s=1}^{k-1}(\tilde{N}_s-\tilde{N}_{s-1})B_{s,k-1}^2
887: =\Big(1\pm\frac{\eta_c}{\eta_g-\eta_c}\Big)
888: \sum_{s=1}^{k-1}(N_s-N_{s-1})B_{s,k-1}^2\,,
889: \end{equation}
890: and similarly
891: \begin{equation} 
892: \sum_{s=1}^{k}\tilde{N}_s\delta_s
893: =\Big(1\pm\frac{\eta_c}{\eta_g-\eta_c}\Big)\sum_{s=1}^k N_s\delta_s\,.
894: \end{equation}
895: Since $\eta_c/\eta_g<1/10$, we therefore have
896: \begin{equation}\label{ApproxGammaTk}
897: \tilde{\gamma}^{\rm fin}_k
898: =
899: \gamma^{\rm fin}_k
900: \frac{(1\pm\frac{\eta_c}{\eta_g-\eta_c})^{3/2}}{1\pm\frac{\eta_c}{\eta_g-\eta_c}}
901: =\gamma^{\rm fin}_k\Big(1\pm 10\frac{\eta_c}{\eta_g}\Big)\,,
902: \end{equation}
903: and similarly
904: \begin{equation}\label{ApproxGamma0}
905: \tilde{\gamma}^{\rm ini}_k
906: =
907: \gamma^{\rm ini}_k\Big(1\pm 10\frac{\eta_c}{\eta_g}\Big)\,.
908: \end{equation}
909: In the above formulas we have used the mean value theorem that states that for
910: any function $f$ that is continuous on the interval $|x|\leq c$, where $c$ is
911: some constant, and differentiable on $|x|<c$ we can write
912: \begin{equation}
913: f(x)=f(0)+xf'(x_0)\,,
914: \end{equation}
915: where $f'(x_0)$ denotes the derivative of $f$ at some point $|x_0|<|x|$. This
916: gives, for example, that for $|x|<1/10$
917: \begin{eqnarray} \label{MeanValueExamples}
918: \frac{1}{1\pm x}&=&1\pm 2x\,,\cr
919: (1\pm x)^{3/2}&=&1\pm 1.6 x\,.
920: \end{eqnarray}
921: The error bounds~(\ref{ApproxGammaTk}) 
922: and~(\ref{ApproxGamma0}) were obtained by simplifying the somewhat tighter
923: but unwieldy bounds using these methods. \\
924: 
925: \subsubsection{Error range for $\tilde{\omega}_k$} \label{subsec:RangeForOmegas}
926: 
927: The aim of this subsection is to determine the ratio
928: between $\tilde{\omega}_k$ and the true value $\omega_k$
929: given by Equations (\ref{TildeOmega_k}) and 
930: (\ref{omega_k}) respectively.
931: Using the mean value theorem we have, by definition,
932: \begin{eqnarray}
933: \tilde{\omega}_k&=& 
934: \arccos\Big(1-\frac{2N_k}{2^aN}(1\pm\frac{\eta_c}{\eta_g-\eta_c})\Big)\cr
935: &&\cr
936: &=&
937: \arccos\Big(1-\frac{2N_k}{2^aN}\Big)
938: -\frac{1}{\sqrt{1-[1-\frac{2N_k}{2^aN}(1+u)]^2}}
939: \Big(\pm\frac{2N_k}{2^aN}\frac{\eta_c}{\eta_g-\eta_c}\Big)\,,
940: \end{eqnarray}
941: where $u$ is a real number such that $|u|<\eta_c/\eta_g$. This implies
942: \begin{equation}
943: \tilde{\omega}_k=\omega_k\pm\sqrt{\frac{2N_k}{2^aN}}
944: \frac{1}{\sqrt{1+u}\sqrt{2-\frac{2N_k}{2^aN}(1+u)}}\frac{\eta_c}{\eta_g-\eta_c}\,.
945: \end{equation}
946: Since $\eta_c/\eta_g<1/10$ we have
947: \begin{equation}
948: \frac{\eta_c}{\eta_g-\eta_c}<\frac{\eta_c}{0.9\eta_g}\,,\ \ \ \ \
949: \sqrt{1+u}>\frac{1}{0.9\sqrt{2}}\,,\ \ \ \ \ 
950: \sqrt{2-\frac{2N_k}{2^aN}(1+u)}>1\,,
951: \end{equation}
952: and therefore
953: \begin{equation}
954: \tilde{\omega}_k=\omega_k\pm 2\frac{\eta_c}{\eta_g}\sqrt{\frac{N_k}{2^aN}}\,.
955: \end{equation}
956: It now remains to find a bound on $\sqrt{\frac{N_k}{2^aN}}$
957: that is linear in $\omega_k$.
958: We have, by definition,
959: \begin{equation}
960: \frac{2N_k}{2^aN}=1-\cos\omega_k=2\sin^2\frac{\omega_k}{2}\,.
961: \end{equation}
962: Since $x^2\geq\sin^2 x$ we
963: obtain
964: \begin{equation} \label{Inequality112}
965: \sqrt{\frac{N_k}{2^aN}}\leq\frac{\omega_k}{2}\,,
966: \end{equation}
967: and therefore
968: \begin{equation}\label{ApproxOmega}
969: \frac{\tilde{\omega}_k}{\omega_k}=1\pm \frac{\eta_c}{\eta_g}\,.
970: \end{equation}
971: 
972: \subsubsection{Proof of the bound}\label{subsec:ProofOfTheBound}
973: 
974: During the $k$th stage
975: our algorithm creates a feature of height
976: \begin{equation}
977: h_k=\alpha_k\sqrt{\frac{2^aN}{N_k}}
978:      \Big(\sin(\omega_k t_k-\xi_k)-\sin(-\xi_k)\Big)\,,
979: \end{equation}
980: where $\xi_k$ is some initial phase.
981: On the other hand, the target height $\delta_k$  is
982: \begin{equation}
983: \delta_k=\alpha_k\sqrt{\frac{2^aN}{N_k}} \,
984:      \Big(\sin(\omega_k\tau_k-\xi_k)-\sin(-\xi_k)\Big)\,.
985: \end{equation}
986: Hence
987: \begin{eqnarray} \label{HeightError}
988: |h_k-\delta_k|&=&
989: \alpha_k\sqrt{\frac{2^aN}{N_k}} \,
990: \Big|\sin(\omega_k t_k-\xi_k)-\sin(\omega_k\tau_k-\xi_k)\Big|\cr
991: &&\cr
992: &\leq&2\alpha_k\sqrt{\frac{2^aN}{N_k}} \,
993:              \Big|\sin\frac{\omega_k(t_k-\tau_k)}{2}\Big|\cr
994: &&\cr
995: &\leq&\alpha_k\sqrt{\frac{2^aN}{N_k}}\;\omega_k|t_k-\tau_k|\,.
996: \end{eqnarray}
997: Directly {from} the definition we obtain
998: \begin{equation}
999: \omega_k t_k=\frac{\omega_k}{\tilde{\omega}_k}
1000: \Big(\arcsin\tilde{\gamma}^{\rm fin}_k
1001: -\arcsin\tilde{\gamma}^{\rm ini}_k\Big)\pm\omega_k\,.
1002: \end{equation}
1003: Using Eqs.~(\ref{ApproxGammaTk}), 
1004: (\ref{ApproxGamma0}), and~(\ref{ApproxOmega}),
1005: using the fact that $10\eta_c/\eta_g\leq1/4$ and using 
1006: the inequality~(\ref{ArcsinInequality})
1007: we have
1008: \begin{equation}
1009: \omega_k t_k=\frac{1}{1\pm\eta_c/\eta_g}
1010: \Big(\zeta_k\pm 4\sqrt{10\frac{\eta_c}{\eta_g}}\Big)\pm\omega_k\,.
1011: \end{equation}
1012: Now using~(\ref{MeanValueExamples}) and the fact that
1013: $|\zeta_k|\leq\pi$ we derive {from} the above equation
1014: \begin{equation}
1015: \omega_k(t_k-\tau_k)=\pm 8\frac{\eta_c}{\eta_g}\pm\omega_k\,.
1016: \end{equation}
1017: Since $a\geq 3$ [see Eqs.(\ref{eq:worstCase}) and~(\ref{eq:epsilonBound})], we
1018: have that $2N_k/(2^aN)\leq 1/4$, and we can therefore use the
1019: inequality~(\ref{ArccosInequality}) to show that
1020: \begin{equation}
1021: \omega_k=\pm 2\sqrt{\frac{2N_k}{2^aN}}\,.
1022: \end{equation}
1023: Since $a\le\log_2(\eta_g/\eta_c)-3$, we obtain the bound
1024: \begin{equation} \label{PhaseError}
1025: \omega_k(t_k-\tau_k)=\pm 16\frac{\eta_c}{\eta_g}\,.
1026: \end{equation}
1027: 
1028: The maximum possible value of the average
1029: amplitude of "bad" states is
1030: \begin{equation}
1031: \max\bar{b}=\frac{1}{\sqrt{2^aN}}\,,
1032: \end{equation}
1033: and the maximum possible value of the average
1034: amplitude of "good" states is
1035: \begin{equation}
1036: \max \bar{g}=\frac{1}{\sqrt{\eta N}}\,.
1037: \end{equation}
1038: One can therefore write
1039: \begin{eqnarray}
1040: \alpha^2_k&<&(\max\bar{b})^2+\frac{(\max\bar{g})^2N_k}{2^aN-N_k}\cr
1041: &\leq&\frac{1}{2^aN}+\frac{1}{\eta(2^a-1)N}\cr
1042: &\leq&\frac{1}{2^aN}+\frac{2}{\eta 2^a N}\cr
1043: &<&\frac{4}{\eta 2^aN} \;.
1044: \end{eqnarray}
1045: Using this bound together with~(\ref{PhaseError})
1046: we obtain for the error~(\ref{HeightError}):
1047: \begin{equation}
1048: |h_k-\delta_k|<\frac{32}{\sqrt{\eta N(1-\eta_c/\eta_g)}}
1049: \cdot\frac{\eta_c}{\eta_g^{3/2}}\,.
1050: \end{equation}
1051: Substituting the parameters~(\ref{eq:worstCase}) into the right-hand side of
1052: the above inequality one can show that
1053: \begin{equation} \label{h_delta_bound}
1054: |h_k-\delta_k|<\frac{\epsilon^2}{\sqrt{\eta N}}\,.
1055: \end{equation}
1056: 
1057: \subsection{Number of exceptional values}   \label{sec:exceptions}
1058: 
1059: When describing our algorithm in section~\ref{sec:Algorithm} we have
1060: introduced functions $p'$ and $p''$ to distinguish two different
1061: approximations to the target function $p$. Namely, if $p'$ is an
1062: approximation of $p$ which is defined by the oracles $o_k$, then 
1063: $p''$ also takes into account the fact that we may not know the 
1064: exact values of $n_k$. In our algorithm we therefore use $p''$
1065: as our target function which coincides with $p'$ everywhere
1066: apart for a small fraction of values of $x$ for which
1067: $p'(x)\neq p''(x)$. In this section we obtain an upper
1068: bound on this fraction which will then be used in 
1069: the next section where we derive bounds on the fidelity
1070: and the failure probability.
1071: 
1072: For all $j$, we have  $|n_j-\tilde n_j|\le\eta_cN$.
1073: For $j<f_1$, we have $\tilde n_j< \eta_g N$, and hence 
1074: \begin{equation}
1075: n_j< (\eta_g+\eta_c) N \;.
1076: \end{equation} 
1077: We now consider, for each $k\in\{2,\ldots,T\}$, all values of $j$ such that 
1078: $f_{k-1}\le j< f_k$. For these values of $j$, we have
1079: \begin{equation}
1080: \tilde n_j \le \tilde n_{f_{k-1}} \;.
1081: \end{equation} 
1082: Since $n_j\ge n_{f_{k-1}}$, we have
1083: \begin{equation}
1084: |\tilde n_j - \tilde n_{f_{k-1}}| \le 2\eta_cN \;, 
1085: \end{equation} 
1086: hence
1087: \begin{equation}
1088: |\tilde n_j - \tilde N_{k-1}| \le 2\eta_cN \;, 
1089: \end{equation} 
1090: and finally
1091: \begin{equation}
1092: |n_j -  N_{k-1}| \le 4\eta_cN \;.
1093: \end{equation} 
1094: Since $T\le1/\epsilon$, we find that $p''(x)\ne p'(x)$ 
1095: for at most $\mu N$ values, where
1096: \begin{equation} \label{mu}
1097: \mu = 4\eta_c/\epsilon + (\eta_g+\eta_c)\,.
1098: \end{equation}
1099: 
1100: \subsection{Fidelity bound and the failure probability}  \label{sec:stage1Fidelity}
1101: 
1102: For $k=T$, Eq.~(\ref{PsiKminusOne}) can be rewritten in the form
1103: \begin{equation}
1104: |\Psi^T\rangle
1105: =\sum_{x=0}^{2^aN-1}\Big(B^T+\sum_{j=1}^T c_j(x)h_j\Big)
1106:  |x\rangle\,,
1107: \end{equation}
1108: where
1109: \begin{equation}
1110: c_j(x)=\left\{\begin{array}{ll}
1111:                  1& {\rm if}\ x<N_j\cr
1112:                          0& {\rm otherwise}\,.
1113:               \end{array}
1114:            \right.
1115: \end{equation}
1116: Let us define
1117: \begin{equation} \label{d}
1118: d(x)=\sum_{j=1}^T c_j(x)(h_j-\delta_j)\,.
1119: \end{equation}
1120: Using this definition we have
1121: \begin{eqnarray}
1122: |\langle\Psi_p|\Psi^T\rangle|
1123: &=& 
1124: \left|\sum_{x=0}^{2^aN-1}\sqrt{p(x)}\,\Big(B^T+\sum_{j=1}^T c_j(x)h_j\Big)\right|\cr
1125: &\geq& 
1126: \left|\sum_{x=0}^{N-1}\sqrt{p(x)}\,\Big(B^T+\sum_{j=1}^T c_j(x)\,\delta_j\Big)\right|
1127: -\left|\sum_{x=0}^{N-1}\sqrt{p(x)}\; d(x)\right|\,,
1128: \end{eqnarray}
1129: where we have used the fact that $p(x)=0$ for $x\geq N$.
1130: Using~(\ref{h_delta_bound}), and since $T\leq 1/\epsilon$ 
1131: we obtain
1132: \begin{equation} \label{bound_on_d}
1133: |d(x)|<\frac{\epsilon}{\sqrt{\eta N}}\;.
1134: \end{equation}
1135: Because $\sqrt{p(x)}\leq 1/\sqrt{\eta N}$, this implies
1136: \begin{equation}
1137: |\langle\Psi_p|\Psi^T\rangle|\geq
1138: \left|\sum_{x=0}^{N-1}\sqrt{p(x)}\,\Big(B^T+\sum_{j=1}^T c_j(x)\,\delta_j\Big)\right|
1139: -\frac{\epsilon}{\eta}\;.
1140: \end{equation}
1141: Rewriting Eq.~(\ref{eq:pDoublePrime}) in terms of the coefficients $c_j(x)$, 
1142: \begin{equation} \label{Ppp_in_terms_of_c}
1143: \sqrt{p''(x)}=\sum_{j=1}^T c_j(x)\,\delta_j\,,
1144: \end{equation}
1145: we can write
1146: \begin{equation}
1147: |\langle\Psi_p|\Psi^T\rangle|\geq
1148: \sum_{x=0}^{N-1}\sqrt{p(x)}\sqrt{p''(x)}
1149: -|B^T|\sqrt{\frac{N}{\eta}}
1150: -\frac{\epsilon}{\eta}\;.
1151: \end{equation}
1152: For all $x$ with a possible exception of at most
1153: $\mu N$ values $p''(x)=p'(x)$ (see Sec.~\ref{sec:exceptions}). Let $\set{S}_e$
1154: be the set of exceptional values of $x$ for which
1155: $p''(x)\neq p'(x)$. We have
1156: \begin{equation}
1157: |\langle\Psi_p|\Psi^T\rangle|\geq
1158: \sum_{x=0}^{N-1}\sqrt{p(x)}\sqrt{p'(x)}
1159: -\sum_{x\in\set{S}_e}\sqrt{p(x)}\Big|\sqrt{p'(x)}-\sqrt{p''(x)}\Big|
1160: -|B^T|\sqrt{\frac{N}{\eta}}
1161: -\frac{\epsilon}{\eta}\;.
1162: \end{equation}
1163: Since $\sqrt{p(x)}$, $\sqrt{p'(x)}$ and $\sqrt{p''(x)}$
1164: are all bounded from above by $1/\sqrt{\eta N}$
1165: we obtain
1166: \begin{equation}
1167: |\langle\Psi_p|\Psi^T\rangle|\geq
1168: \sum_{x=0}^{N-1}\sqrt{p(x)}\sqrt{p'(x)}
1169: -|B^T|\sqrt{\frac{N}{\eta}}
1170: -\frac{\epsilon+\mu}{\eta}\;.
1171: \end{equation}
1172: By definition of $p'$
1173: \begin{equation}
1174: |\sqrt{p'(x)}-\sqrt{p(x)}|\leq \frac{\epsilon}{\sqrt{\eta N}}\;,
1175: \end{equation}
1176: and since $p$ is normalized we get
1177: \begin{equation}   \label{fidelity_bound_almost}
1178: |\langle\Psi_p|\Psi^T\rangle|\geq
1179: 1-|B^T|\sqrt{\frac{N}{\eta}}
1180: -\frac{2\epsilon+\mu}{\eta}\;.
1181: \end{equation}
1182: In order to continue we need to calculate $|B^T|$.
1183: This can be done by examining the normalization condition
1184: $\langle\Psi^T|\Psi^T\rangle=1$. This condition reads
1185: \begin{equation}
1186: \sum_{x=0}^{2^aN-1}
1187: \Big(
1188: B^T+\sum_{j=1}^T c_j(x)\,h_j
1189: \Big)^2=1\,.
1190: \end{equation}
1191: Using~(\ref{d}) and~(\ref{Ppp_in_terms_of_c}) this
1192: can be rewritten as
1193: \begin{equation}
1194: \sum_{x=0}^{2^aN-1}
1195: \Big(\sqrt{p''(x)}
1196: +B^T+d(x)
1197: \Big)^2=1\,,
1198: \end{equation}
1199: or
1200: \begin{equation}  \label{JustBeforeQuadratic}
1201: \sum_{x=0}^{2^aN-1}
1202: \Big(\sqrt{p'(x)}
1203: +B^T+d(x)
1204: \Big)^2
1205: -\Lambda
1206: =1\,,
1207: \end{equation}
1208: where
1209: \begin{eqnarray}
1210: \Lambda&=&\sum_{x\in\set{S}_e}
1211: \left(\Big(\sqrt{p'(x)}
1212: +B^T+d(x)
1213: \Big)^2
1214: -\Big(\sqrt{p''(x)}
1215: +B^T+d(x)
1216: \Big)^2\right)\cr
1217: &=&2 B^T\sum_{x\in\set{S}_e}\Big(\sqrt{p'(x)}-\sqrt{p''(x)}\Big)
1218: +\sum_{x\in\set{S}_e}\Big(p'(x)-p''(x)\Big)\cr
1219: & &+ 2\sum_{x\in\set{S}_e}\Big(\sqrt{p'(x)}-\sqrt{p''(x)}\Big)d(x) \,.
1220: \end{eqnarray}
1221: Let us define
1222: \begin{equation}
1223: e(x)=\sqrt{p'(x)}-\sqrt{p(x)}\,.
1224: \end{equation}
1225: Since $p$ is normalized, equation~(\ref{JustBeforeQuadratic})
1226: gives a quadratic equation for $B^T$:
1227: \begin{equation}
1228: (B^T)^2+2U B^T +V =0\,,
1229: \end{equation}
1230: where
1231: \begin{equation}
1232: U=\frac{1}{2^a N}
1233: \left(
1234: \sum_{x=0}^{N-1}\Big(\sqrt{p'(x)}+d(x)\Big)
1235: +\sum_{x\in\set{S}_e}(\sqrt{p''(x)}-\sqrt{p'(x)})
1236: \right)\;,
1237: \end{equation}
1238: and
1239: \begin{align}
1240: V=&\frac{1}{2^a N}
1241: \sum_{x=0}^{N-1}\left(2\sqrt{p(x)}\Big(d(x)+e(x)\Big)+
1242: \Big(d(x)+e(x)\Big)^2
1243: \right)\cr
1244: &+\frac{1}{2^a N}\sum_{x\in\set{S}_e}
1245: \left(
1246: p''(x)-p'(x)+2d(x)\Big(\sqrt{p''(x)}-\sqrt{p'(x)}\Big)
1247: \right)\,.
1248: \end{align}
1249: Since $\sqrt{p'(x)}$ and $\sqrt{p''(x)}$
1250: are bounded from above by $1/\sqrt{\eta N}$
1251: and since $\set{S}_e$ contains at most
1252: $\mu N$ elements (see Sec.~\ref{sec:exceptions}), we obtain with the help
1253: of~Eq.(\ref{bound_on_d})
1254: \begin{equation}
1255: |U|\leq\frac{1+\epsilon+\mu}{2^a\sqrt{\eta N}}\;.
1256: \end{equation}
1257: Similarly, since $|e(x)|\leq\epsilon/\sqrt{\eta N}$ we
1258: have
1259: \begin{equation}
1260: |V|\leq\frac{6\epsilon+4\epsilon^2+\mu}{2^aN\eta}\;.
1261: \end{equation} 
1262: Since $\mu<\epsilon^2$ and $2^a>6/\epsilon^2$,
1263: see Eqs.~(\ref{mu}) and~(\ref{eq:worstCase})
1264: respectively, we obtain
1265: \begin{equation}
1266: |B^T|\leq |U|+\sqrt{U^2+|V|}\leq\frac{2\epsilon^2}{\sqrt{\eta N}}\;.
1267: \end{equation}
1268: Together with Eq.~(\ref{fidelity_bound_almost}) this gives
1269: the lower bound on the fidelity,
1270: \begin{equation}
1271: |\langle\Psi_p|\Psi^T\rangle|\geq 1-\frac{3\epsilon}{\eta}\;,
1272: \end{equation}
1273: where we have observed that $\epsilon<1/3$ and used the 
1274: bounds $2^a<7/\epsilon^3$,
1275: $\mu<\epsilon^2$, which follow from our
1276: settings given in Eq.~(\ref{eq:worstCase}).
1277: The failure probability is 
1278: \begin{equation} \label{TheFailureProbability}
1279: p_{\rm fail}=(2^aN-1)N |B^T|^2<\frac{28\epsilon}{\eta}<10\lambda\,.
1280: \end{equation}
1281: 
1282: 
1283: 
1284: \subsection{Introduction of phases and the fidelity bound}   \label{sec:stage2Fidelity}
1285: 
1286: We now show that the choice $\lambda'={\epsilon'}^2/8$ together with the
1287: inequality~(\ref{eq:tildePhiBound}), i.e., $|\tilde\phi(x) - \phi(x)|
1288: \le\epsilon'/2$, implies the overall fidelity
1289: bound~(\ref{eq:properFidelityBound}). The proof is straightforward.
1290: \begin{eqnarray}
1291: |\langle\tilde\Psi|\Psi\rangle| 
1292: &=& \Big| \sum_x \sqrt{p(x)\tilde p(x)} \,
1293:            \exp[2\pi i(\phi(x)-\tilde \phi(x))] \Big| \cr
1294: &\ge& \sum_x \sqrt{p(x)\tilde p(x)} \, 
1295:       \cos[\phi(x)-\tilde \phi(x)]  \cr
1296: &\ge& \sum_x \sqrt{p(x)\tilde p(x)} \, 
1297:       \big( 1- [\phi(x)-\tilde \phi(x)]^2/2 \big) \cr
1298: &\ge& \sum_x \sqrt{p(x)\tilde p(x)} \, 
1299:       ( 1-\epsilon'^2/8 ) \cr
1300: &=& |\langle\Psi_{\tilde p}|\Psi_p\rangle| \;
1301:       ( 1-\lambda' ) \cr
1302: &>& 1-\lambda-\lambda' \;.
1303: \end{eqnarray}
1304: 
1305: \section{Resources} \label{sec:resources}
1306: 
1307: In this section we provide worst case upper bounds
1308: on the resources required by the algorithm.
1309: We distinguish between the resources that are needed for the
1310: state preparation part of the algorithm 
1311: (subsection~\ref{subsec:StatePrep})
1312: and the resources that are needed by 
1313: the quantum counting that precedes
1314: the actual state preparation (subsection~\ref{subsec:QCounting}). 
1315: 
1316: 
1317: \subsection{Resources needed for state preparation} \label{subsec:StatePrep}
1318: 
1319: \subsubsection{Auxiliary qubits}
1320: 
1321: {From} our settings~(\ref{eq:worstCase}) we obtain
1322: \begin{equation}
1323: \frac{\eta_g}{\eta_c}<54/\epsilon^3\,.
1324: \end{equation}
1325: We thus obtain for the number of auxiliary qubits
1326: \begin{equation}
1327: a\le\log_2(\eta_g/\eta_c)-3<3+\log_2\epsilon^{-3}\,.
1328: \end{equation}
1329: 
1330: \subsubsection{Oracle calls}
1331: 
1332: Here we give an upper bound on the time resources needed by the algorithm. The
1333: construction of one feature requires at most
1334: \begin{equation}
1335: \max(t_k)\leq\frac{2\pi}{\omega_k}
1336: \end{equation}
1337: oracle calls. Using inequality~(\ref{Inequality112})
1338: we can therefore write
1339: \begin{equation}
1340: \max t_k\leq \pi\sqrt{\frac{2^aN}{N_k}}\,.
1341: \end{equation}
1342: {From}~(\ref{eq:worstCase}) we have
1343: \begin{equation}
1344: \eta_g-\eta_c>\frac{8}{9}\epsilon^2\,.
1345: \end{equation}
1346: Since there are at most $1/\epsilon$ features and because
1347: $N_k\leq(\eta_g-\eta_c)N$ and $2^a<8/\epsilon^3$ we therefore have that the
1348: total number of oracle calls, $n_{\rm oracle}$, satisfies the bound
1349: \begin{equation}
1350: n_{\rm oracle}\le
1351: \frac{\max t_k}{\epsilon} < 
1352: \frac{3\pi}{\epsilon^3\sqrt{{\epsilon}}}\;.
1353: \end{equation}
1354: 
1355: \subsection{Resources needed for counting} \label{subsec:QCounting}
1356: 
1357: \subsubsection{Counting accuracy}
1358: 
1359: Consider an oracle $O$ on the set of $2^aN$ possible values of $x$.
1360: Using  standard techniques we can count the number $M$ of solutions
1361: of $O$ within the absolute error $\Delta M$
1362: \begin{equation}
1363: \Delta M <\Big{(}\sqrt{2^aNM}+\frac{N}{2^{m-a+2}}\Big{)}2^{-m}\,,
1364: \end{equation}
1365: where $m$ is the number of auxiliary qubits needed by the standard
1366: quantum counting routine~\cite{Nielsen}.
1367: 
1368: We want $\Delta M<\eta_cN$, where $\eta_c$ is the counting
1369: accuracy introduced earlier. This connects the desired
1370: counting accuracy $\eta_c$ with the number of auxiliary
1371: qubits $m$,
1372: \begin{equation}
1373: \eta_c=\Big{(}\sqrt{\frac{2^aM}{N}}+{2^{a-2}\lambda}\Big{)}\lambda\,,
1374: \end{equation}
1375: where $\lambda=2^{-m}$.
1376: Solving this equation for $\lambda$ in the case $\lambda>0$, we have
1377: \begin{equation}
1378: \lambda=2^{1-a/2}\Big{(}\sqrt{y+\eta_c}-\sqrt{y}\Big{)}\,,
1379: \end{equation}
1380: where $y=M/N$.  We see that, the bigger the value of $a$,
1381: the bigger $m$ has to be in order to give the
1382: required counting accuracy $\eta_c$.
1383: We therefore set $a$ to the minimum, i.e., $a=1$ (this doubles the
1384: range of $x$ values to
1385: ensure reliable counting, see e.g.~\cite{Nielsen}).
1386: 
1387: It is easy to check that the dependence of $\lambda$
1388: on $y$ is monotonic. As we
1389: vary $M$ in the range 0 to $N-1$, the corresponding values of
1390: $\lambda$ vary between the limits $\sqrt{2\eta_c}$ and
1391: $\sqrt{2}(\sqrt{1+\eta_c}-1)>\eta_c/2 $. It follows that the required
1392: number of auxiliary working qubits needed for counting with accuracy
1393: $\eta_c$
1394: is $m<\log\eta_c^{-1}$. Thus we choose $m=\log\eta_c^{-1}$.
1395: This choice guarantees the required accuracy of counting irrespective of
1396: the true value of $M$.
1397: 
1398: 
1399: \subsubsection{Counting probability}
1400: 
1401: The above counting procedure does not output the correct result with
1402: probability 1.  For the procedure to work correctly with probability $1-\nu$ we
1403: have to increase the number of auxiliary qubits {from} $m$ to $a_c$ which is
1404: given by
1405: \begin{equation}
1406: a_c=m+\log_2(2+\frac{1}{2\nu})=\log_2\frac{1+4\nu}{2\nu\eta_c}\,.
1407: \end{equation}
1408: The number, $N_{\rm count}$, 
1409: of oracle calls that is required by 
1410: the counting procedure is
1411: \begin{equation}
1412: N_{\rm count}=2^{a_c}-1 \,.
1413: \end{equation}
1414: Substituting $m=\log_2\eta_c^{-1}$ and using
1415: Eq.~(\ref{eq:worstCase}) we obtain
1416: \begin{equation}
1417: a_c<\log_2\frac{27(1+4\nu)}{\nu\epsilon^5} \,.
1418: \end{equation}
1419: Since there are at most $1/\epsilon$ features the total number of oracle calls
1420: needed by the counting stage of our algorithm is bounded as
1421: \begin{equation}
1422: N_{\rm count}^{\rm total}\leq\frac{N_{\rm count}}{\epsilon}
1423: <\frac{27(1+4\nu)}{\nu\epsilon^6}\,.
1424: \end{equation}
1425: 
1426: \section{Summary and conclusions} \label{sec:conclusions}
1427: 
1428: In conclusion, we have described a quantum algorithm to prepare an arbitrary
1429: state of a quantum register of $\log_2N$ qubits, provided the state is initially
1430: given in the form of a classical algorithm to compute the $N$ complex
1431: amplitudes defining the state. For an important class of states, the algorithm
1432: is efficient in the sense of requiring numbers of oracle calls and
1433: additional gate operations that are polynomial in the number of qubits.
1434: The following
1435: table lists, for each stage of the algorithm, upper bounds on the number of
1436: oracle calls and the number of auxiliary qubits needed. 
1437: 
1438: \begin{tabular}{lcc}     
1439: $\;$ & oracle calls & auxiliary qubits \vspace{2mm} \\ 
1440: counting & 
1441:  $\frac{27(1+4\nu)}{\nu\epsilon^6}$ & 
1442:  $\log_2\frac{27(1+4\nu)}{\nu\epsilon^5}$ \vspace{2mm} \\ 
1443: preparing $|\Psi_{\tilde p}\rangle$ & 
1444:  $\frac{3\pi}{\epsilon^3\sqrt{{\epsilon}}}$ &
1445:  $3+3\log_2{1\over\epsilon}$ \vspace{2mm} \\
1446: preparing $|\tilde\Psi\rangle$ & ${1\over\epsilon'}$ & 0 \vspace{2mm}
1447: \end{tabular}
1448: 
1449: The bounds are not
1450: tight and can be improved by a more detailed error analysis.  The total
1451: number of quantum gate operations depends on the implementation of the
1452: oracles. It is proportional to the number of oracle calls times a factor
1453: polynomial in $\log_2 N$ if the functions $p(x)$ and $\phi(x)$ can be
1454: efficiently computed classically.
1455: 
1456: Depending on the nature of the function $p(x)$ and the prior information about
1457: $p(x)$, the algorithm we have described in this paper can be
1458: optimized in a number of ways. For instance, the counting stage is the most
1459: expensive in terms of both oracle calls and additional qubits. If for some
1460: reason the numbers $n_k$ characterizing the oracles are known in advance, the
1461: counting stage can be omitted, leading to considerable savings. Furthermore,
1462: in this case the fidelity bound can be guaranteed with probability 1, i.e., we
1463: can set $\nu=0$.
1464: 
1465: In some cases the algorithm can be simplified if, instead of using the oracles
1466: defined in Eq.~(\ref{eq:ok}), one uses oracles that return the
1467: $k$-th bit of the expression $\sqrt{p(x)/\eta N}$. The general conclusions of
1468: the paper continue to hold for this variant of the algorithm, 
1469: which we analyze in detail in~Ref.~\cite{SoklakovSchack}.
1470: 
1471: Finally, by using generalizations of Grover's algorithm in which the
1472: oracles and the inversion about the mean introduce complex phase factors
1473: \cite{Long1999,Zalka-9902} it is possible to reduce the number of auxiliary
1474: qubits needed in the preparation stage of the algorithm. This leads to a
1475: reduction in the number of required oracle calls, and could also be
1476: important in implementations where the number of qubits is the main limiting
1477: factor.
1478: 
1479: 
1480: \section{Acknowledgments}
1481: 
1482: This work was supported in part by the European Union IST-FET project EDIQIP. 
1483: 
1484: 
1485: \appendix
1486: 
1487: \section{Appendix}
1488: 
1489: \subsection{Notation for double inequalities}
1490: 
1491: In this paper we have made a frequent use of the
1492: following convention.
1493: Let $a$, $b$ and $c$ be three numbers. The notation 
1494: \begin{equation}
1495: a = b\pm c
1496: \end{equation}
1497: is then understood to be equivalent to the double inequality
1498: \begin{equation} \label{DoubleInequality}
1499: b-c \leq a \leq b+c \;.
1500: \end{equation}
1501: Furthermore, let $g$, $e$ and $F$ be functions. The notation 
1502: \begin{equation}
1503: h(x) = \sum_{x\in{\cal I}} F\left(g(x)\pm e(x)\right) 
1504: \end{equation}
1505: is then equivalent to the statement that $h(x)$ can be written in the form
1506: \begin{equation}
1507: h(x) = \sum_{x\in{\cal I}} F\left(f(x)\right) \;,
1508: \end{equation}
1509: where $f(x)=g(x)\pm e(x)$ for all $x\in{\cal I}$.
1510: 
1511: 
1512: \subsection{Trigonometric inequalities}
1513: Here we prove the following
1514: inequalities
1515: \begin{equation}\label{ArcsinInequality}
1516: |\arcsin(x+\nu)-\arcsin(x)|\leq 2\sqrt{|\nu|}\,,\ \ \ \ |\nu|\leq 1/4\,,
1517: \end{equation}
1518: and
1519: \begin{equation} \label{ArccosInequality}
1520: |\arccos(x+\nu)-\arccos(x)|\leq 2\sqrt{\nu}\,,\ \ \ \ |\nu|\leq 1/4\,.
1521: \end{equation}
1522: Consider the case $\nu\geq0$, which implies
1523: that for any $x$
1524: \begin{equation}
1525: \arcsin(x+\nu)-\arcsin(x)\geq 0\,.
1526: \end{equation}
1527: By inspection of $\arcsin$-function we have that
1528: for $0\leq\nu\leq 1/4$ the maximum value
1529: of the difference $(\arcsin(x+\nu)-\arcsin(x))$
1530: is achieved for $x=-1$:
1531: \begin{equation} \label{maxArcsinDifference}
1532: \max_x\Big(\arcsin(x+\nu)-\arcsin(x)\Big)=
1533: \arcsin(\nu-1)-\arcsin(-1)\,.
1534: \end{equation}
1535: In the case of $y<z$ the following equality
1536: holds~\cite{GradsteynRyzhik}
1537: \begin{equation}
1538: \arcsin z-\arcsin y=\arccos\Big(\sqrt{1-y^2}\sqrt{1-z^2}+yz\Big)\,.
1539: \end{equation}
1540: Applying this equality to the right hand side 
1541: of~(\ref{maxArcsinDifference}) we obtain
1542: \begin{equation} \label{AfterGradshteynRyzhik}
1543: \arcsin(x+\nu)-\arcsin(x)
1544: \leq \arccos(1-\nu)\,.
1545: \end{equation}
1546: Let us now look for a constant $c$
1547: such that
1548: \begin{equation} \label{ArccosOneMinusNu}
1549: \arccos(1-\nu)\leq c\sqrt{\nu}\,. 
1550: \end{equation}
1551: Since $\arccos$ is a decreasing function
1552: the above requirement is equivalent to
1553: \begin{equation} \label{OneMinusNu}
1554: 1-\nu\geq\cos(c\sqrt{\nu})\,.
1555: \end{equation}
1556: According to the mean value theorem,
1557: there exists $u<c\sqrt{\nu}$ such that
1558: \begin{equation}
1559: \cos(c\sqrt{\nu})=1-\frac{c^2\nu}{2}\cos(u)\,,
1560: \end{equation}
1561: and therefore the requirement~(\ref{OneMinusNu})
1562: can be rewritten as
1563: \begin{equation}
1564: 1\leq \frac{c^2}{2}\cos(u)\,.
1565: \end{equation}
1566: It is clear that this requirement is guaranteed
1567: to be satisfied if we set $c=2$.
1568: Indeed, $2\cos u> 1$ for any nonnegative
1569: $u<\pi/3$ which includes all possible values
1570: of $u$ that can correspond to $c=2$ and $\nu\leq 1/4$. 
1571: Since $c=2$ guarantees that~(\ref{ArccosOneMinusNu})
1572: is satisfied, we obtain from~(\ref{AfterGradshteynRyzhik})
1573: \begin{equation}
1574: \arcsin(x+\nu)-\arcsin(x)
1575: \leq 2\sqrt{\nu}\,,\ \ \ \nu\geq 0.
1576: \end{equation}
1577: The case of negative $\nu$ can be treated in an analogous
1578: fashion leading to the inequality
1579: \begin{equation}
1580: \arcsin(x)-\arcsin(x+\nu)
1581: \leq 2\sqrt{|\nu|}\,,\ \ \ \nu\leq 0.
1582: \end{equation}
1583: The required inequality~(\ref{ArcsinInequality})
1584: follows  trivially.
1585: Moreover, since
1586: \begin{equation}
1587: \arcsin x +\arccos x=\pi/2,
1588: \end{equation}
1589: we also obtain (\ref{ArccosInequality}) as required.
1590: 
1591: 
1592: 
1593: 
1594: 
1595: 
1596: 
1597: %\bibliographystyle{prsty}
1598: %\bibliography{/home/rschack/lit/p}
1599: 
1600: \begin{thebibliography}{10}
1601: 
1602: \bibitem{Lloyd1996}
1603: S. Lloyd, Science {\bf 273},  1073  (1996).
1604: 
1605: \bibitem{Zalka1998}
1606: C. Zalka, Proc.\ R. Soc.\ Lond.\ A {\bf 454},  313  (1998).
1607: 
1608: \bibitem{Somaroo1999}
1609: S.~S. Somaroo, C.-H. Tseng, T. F. Havel, R. Laflamme, and D. G. Cory, 
1610: Phys.\ Rev.\ Lett.\ {\bf 82},  5381  (1999).
1611: 
1612: \bibitem{Percival1992}
1613: I. C. Percival, in {\em Quantum Chaos, Quantum Measurement}, 
1614: edited by P. Cvitanovi\'c, I. C. Percival, and A. Wirzba 
1615: (Kluwer, Dordrecht, Holland, 1992), p.~199.
1616: 
1617: \bibitem{Grover1997}
1618: L.~K. Grover, Phys.\ Rev.\ Lett.\ {\bf 79},  325  (1997).
1619: 
1620: \bibitem{Boyer1998}
1621: M. Boyer, G. Brassard, P. H{\o}yer, and A. Tapp, Fortschritte der Physik {\bf
1622:   46},  493  (1998).
1623: 
1624: \bibitem{Grover-0208}
1625: L. Grover and T. Rudolph, e-print quant-ph/0208112.
1626: 
1627: \bibitem{Kaye2001}
1628: P. Kaye and M. Mosca,  in {\em Proceedings, International Conference on Quantum
1629:   Information} (Rochester, New York, 2001), e-print quant-ph/0407102.
1630: 
1631: \bibitem{Cleve1998}
1632: R. Cleve, A. Ekert, C. Macchiavello, and M. Mosca, Proc.\ R. Soc.\ Lond.\ A
1633:   {\bf 454},  339  (1998).
1634: 
1635: \bibitem{Rudolph-unpublished} T. Rudolph, private communication.
1636: 
1637: \bibitem{Ventura1999}
1638: D. Ventura and T. Martinez, Found.\ Phys.\ Lett.\ {\bf 12},  547  (1999).
1639: 
1640: \bibitem{Long2001b}
1641: G.~L. Long and Y. Sun, Phys.\ Rev.\ A {\bf 64}, 014303 (2001).
1642: 
1643: \bibitem{Andrecut2001}
1644: M. Andrecut and M.~K. Ali, Mod.\ Phys.\ Lett.\ B {\bf 15},  1259  (2001).
1645: 
1646: \bibitem{Zeng2000c}
1647: H.-S. Zeng and L.-M. Kuang, Commun.\ Theor.\ Phys.\ {\bf 33},  11  (2000).
1648: 
1649: \bibitem{Aharonov-0301} D. Aharonov and A. Ta-Shma (2003), 
1650: e-print quant-ph/0301023.
1651: 
1652: \bibitem{Biham1999}
1653: E. Biham, O. Biham, D. Biron, M. Grassl, and D. A. Lidar, 
1654: Phys.\ Rev.\ A {\bf 60},  2742  (1999).
1655: 
1656: \bibitem{Long1999}
1657: G.~L. Long, Y.~S. Li, W.~L. Zhang, and L. Niu, Phys.\ Lett.\ A {\bf 262},  27
1658:   (1999).
1659: 
1660: \bibitem{Zalka-9902}
1661: C. Zalka, e-print quant-ph/9902049.
1662: 
1663: \bibitem{Nielsen}
1664: M.\ Nielsen and I.\ C.\ Chuang,
1665: {\it Quantum Computation and Quantum Information}
1666: (Cambridge, 2000).
1667: 
1668: \bibitem{SoklakovSchack}
1669: A.\ N.\ Soklakov and R.\ Schack,
1670: e-print quant-ph/0411010.
1671: 
1672: \bibitem{GradsteynRyzhik}
1673: I.\ S.\ Gradsteyn and I.\ M.\ Ryzhik,
1674: {\it Tables of Integrals, Series, and Products}
1675: (Academic Press, 1994).
1676: 
1677: \end{thebibliography}
1678: 
1679: \end{document}
1680: