FERMILAB-PUB-21-018-QIS Prepared for submission to ACM Transactions on Quantum Computing February 09, 2021 Non-Boolean Quantum Amplitude Amplification and Quantum Mean Estimation
PRASANTH SHYAMSUNDAR , Fermi National Accelerator Laboratory, USA This paper generalizes the quantum amplitude amplification and amplitude estimation algorithms to work with non-boolean oracles. The action of a non-boolean oracle 푈휑 on an eigenstate |푥⟩ is to apply a state- dependent phase-shift 휑 (푥). Unlike boolean oracles, the eigenvalues exp(푖휑 (푥)) of a non-boolean oracle are not restricted to be ±1. Two new oracular algorithms based on such non-boolean oracles are introduced. The first is the non-boolean amplitude amplification algorithm, which preferentially amplifies the amplitudesof the eigenstates based on the value of 휑 (푥). Starting from a given initial superposition state |휓0⟩, the basis states with lower values of cos(휑) are amplified at the expense of the basis states with higher valuesof cos(휑). The second algorithm is the quantum mean estimation algorithm, which uses quantum phase estimation
to estimate the expectation 휓0 푈휑 휓0 , i.e., the expected value of exp(푖휑 (푥)) for a random 푥 sampled by making a measurement on |휓0⟩. It is shown that the quantum mean estimation algorithm offers a quadratic speedup over the corresponding classical algorithm. Both algorithms are demonstrated using simulations for a toy example. Potential applications of the algorithms are briefly discussed. CCS Concepts: • Theory of computation → Quantum computation theory; • Computer systems or- ganization → Quantum computing. Additional Key Words and Phrases: quantum algorithm, quantum speedup, Grover’s algorithm, quantum machine learning, state overlap
1 INTRODUCTION Grover’s algorithm, introduced in Ref. [1], is a quantum search algorithm for finding the unique input 푥good that satisfies 푓bool (푥good) = 1 , (1)
for a given boolean function 푓bool : {0, 1, . . . , 푁 − 1} → {0, 1}. Such an input 푥good satisfying (1) is referred to as the winning input of 푓bool. Grover’s original algorithm has also been adapted to work with boolean functions with multiple winning inputs [2], where the goal is to find any one of the winning inputs. An important generalization of Grover’s algorithm is the amplitude amplification algorithm 푓 푈^ [3–5], in which the function bool is accessed through a boolean quantum oracle 푓bool that acts on the orthonormal basis states |0⟩ ,..., |푁 − 1⟩ as follows: ( arXiv:2102.04975v1 [quant-ph] 9 Feb 2021 − |푥⟩ , 푓 (푥) = 1 , 푈^ 푥 if bool 푓bool | ⟩ = (2) + |푥⟩ , if 푓bool (푥) = 0 . In this way, the oracle marks the winning states by flipping their phase (shifting the phase by 휋). Given a superposition state |휓0⟩, the goal of the amplitude amplification algorithm is to amplify the amplitudes (in the superposition state) of the winning states. The algorithm accomplishes this iteratively, by initializing a quantum system in the state |휓0⟩ and performing the operation 푆 푈^ 휓0 푓bool on the system during each iteration, where 푆 휓 휓 퐼 . 휓0 ≡ 2 | 0⟩⟨ 0| − (3) Here, 퐼 is the identity operator. Performing a measurement on the system after the iterative ampli- fication process results in one of winning states with high probability. Grover’s original algorithm
Author’s address: Prasanth Shyamsundar, [email protected], Fermi National Accelerator Laboratory, Fermilab Quantum Institute, PO Box 500, Batavia, Illinois, 60510-0500, USA. 2 Prasanth Shyamsundar is a special case of the amplitude amplification algorithm, where a) the uniform superposition state |푠⟩, given by 푁 −1 1 ∑︁ |푠⟩ = √ |푥⟩ , (4) 푁 푥=0 is used as the initial state |휓0⟩ of the system, and b) there is exactly one winning input. Closely related to the amplitude amplification algorithm is the amplitude estimation algorithm [5, 6]. It combines ideas from the amplitude amplification algorithm and the quantum phase estimation (QPE) algorithm [7] to estimate the probability that making a measurement on the initial state |휓0⟩ will yield a winning input. If the uniform superposition state |푠⟩ is used as |휓0⟩, the amplitude estimation algorithm can help estimate the number of winning inputs of 푓bool—this special case is also referred to as the quantum counting algorithm [6]. The amplitude amplification algorithm and the amplitude estimation algorithm have awide range of applications, and are important primitives that feature as subroutines in a number of other quantum algorithms [8–18√]. The amplitude amplification algorithm can be used to finda 1 winning input to 푓bool with O 푁 queries of the quantum oracle, regardless of whether the number of winning states is a priori known or unknown [2]. This represents a quadratic speedup 1 over classical algorithms, which require O(푁 ) evaluations of the function 푓bool. Similarly, the amplitude estimation algorithm also offers a quadratic speedup over the corresponding classical approaches [5]. The quadratic speedup due to the amplitude amplification algorithm has been shown to be optimal for oracular quantum search algorithms [19]. A limitation of the amplitude amplification and estimation algorithms is that they work only with boolean oracles, which classify the basis states as good and bad. On the other hand, one might be interested in using these algorithms in the context of a non-boolean function of the input 푥. In such situations, the typical approach is to create a boolean oracle from the non-boolean function, by using a threshold value of the function as the decision boundary—the winning states are the ones for which the value of the function is, say, less than the chosen threshold value [20, 21]. In this way, the problem at hand can be adapted to work with the standard amplitude amplification and estimation algorithms. Another approach is to adapt the algorithms to work directly with non-boolean functions [15]. This paper generalizes the amplitude amplification and estimation algorithms to work with quantum oracles for non-boolean functions. In particular, a) the boolean amplitude amplification algorithm of Ref. [5] is generalized to the non-boolean amplitude amplification algorithm, and b) the amplitude estimation algorithm of Ref. [5] is generalized to the quantum mean estimation algorithm. Henceforth, the qualifiers “boolean” and “non-boolean” will be used whenever necessary, in order to distinguish between the different versions of the amplitude amplification algorithm. The rest of this section introduces non-boolean oracles and describes the goals of the two main algorithms of this paper.
1.1 Oracle for a Non-Boolean Function 푈^ The behavior of the boolean oracle 푓bool in (2) can be generalized to non-boolean functions by allowing the oracle to perform arbitrary phase-shifts on the different basis states. More concretely, let 휑 : {0, 1, . . . , 푁 − 1} → R be a real-valued function, and let 푈휑 be a quantum oracle given by 푁 −1 ∑︁ 푖휑 (푥) 푈휑 ≡ 푒 |푥⟩⟨푥| . (5) 푥=0 √ 1The O( 푁 ) and O(푁 ) scalings for the quantum and classical algorithms, respectively, hold assuming that the number of winning states does not scale with 푁 . Non-Boolean Quantum Amplitude Amplification and Quantum Mean Estimation 3
† The actions of the oracle 푈휑 and its inverse 푈휑 on the basis states |0⟩ ,..., |푁 − 1⟩ are given by +푖휑 (푥) h i 푈휑 |푥⟩ = 푒 |푥⟩ = cos 휑 (푥) + 푖 sin 휑 (푥) |푥⟩ , (6) h i 푈 † 푥 푒−푖휑 (푥) 푥 휑 푥 푖 휑 푥 푥 . 휑 | ⟩ = | ⟩ = cos ( ) − sin ( ) | ⟩ (7)
1.2 Goal of the Non-Boolean Amplitude Amplification Algorithm
Given an oracle 푈휑 and an initial state |휓0⟩, the goal of the non-boolean amplitude amplification algorithm introduced in this paper is to preferentially amplify the amplitudes of the basis states |푥⟩ with lower values of cos 휑 (푥), at the expense of the amplitude of states with higher values of cos 휑 (푥). Depending on the context in which the algorithm is to be used, a different function of interest 푓 (which is intended to guide the amplification) can be appropriately mapped onto the function 휑. For example, if the range of 푓 is [0, 1] and one intends to amplify the states with higher values of 푓 , then (8) shows two different options for formulating the problem in termsof 휑. 휑 (푥) = 휋 푓 (푥) or 휑 (푥) = arccos 1 − 2푓 (푥) . (8) In both these cases, cos(휑) is monotonically decreasing in 푓 . The connection between the boolean and non-boolean amplitude amplification algorithms can be seen as follows: If either of the two options in (8) is used to map a boolean function 푓bool onto 휑bool, then ( 휋 , if 푓bool (푥) = 1 , 휑bool (푥) = (9) 0 , if 푓bool (푥) = 0 . † In this case, it can be seen from (2), (6), and (7) that the oracle 푈휑 and its inverse 푈휑 both reduce to a boolean oracle as follows: 푈 = 푈 † = 푈^ . 휑bool 휑bool 푓bool (10) Congruently, the task of amplifying (the amplitude of) the states with lower values of cos(휑) aligns with the task of amplifying the winning states |푥⟩ with 푓bool (푥) = 1.
1.3 Goal of the Quantum Mean Estimation Algorithm
Given a generic unitary operator 푈 and a state |휓0⟩, the goal of the quantum mean estimation algorithm introduced in this paper is to estimate the quantity
⟨휓0 | 푈 |휓0⟩ . (11)
In this paper, this task will be phrased in terms of the oracle 푈휑 as estimating the expectation of the eigenvalue 푒푖휑 (푥) , for a state |푥⟩ chosen randomly by making a measurement on the superposition state |휓0⟩. The connection between the two tasks can be seen, using (5), as follows: 푁 −1 푁 −1 ∑︁ 푖휑 (푥) ∑︁ 2 푖휑 (푥) 휓0 푈휑 휓0 = 휓0 푒 푥 푥 휓0 = ⟨푥 |휓0⟩ 푒 . (12) 푥=0 푥=0 2 Here, ⟨푥 |휓0⟩ is the probability for a measurement on |휓0⟩ to yield 푥. The only difference between
• estimating 휓0 푈휑 휓0 for an oracle 푈휑 of the form in (5), and • estimating ⟨휓0 | 푈 |휓0⟩ for a generic unitary operator 푈 is that {|0⟩ ,..., |푁 − 1⟩} is known, beforehand, to be an eigenbasis of 푈휑 . On the other hand, the eigenstates of a generic unitary operator 푈 may be a priori unknown. However, as we will see, the mean estimation algorithm of this paper does not use the knowledge of the eigenstates, and hence is applicable for generic unitary operators 푈 as well. 4 Prasanth Shyamsundar
As mentioned before, the mean estimation algorithm of this paper is a generalization of the amplitude estimation algorithm of Ref. [5]. To see the connection between the respective tasks of these algorithms, note that the eigenvalues of a boolean oracle are either +1 or −1, and the expectation of the eigenvalue under |휓0⟩ is directly related to the probability of a measurement yielding a winning state with eigenvalue −1. This probability is precisely the quantity estimated by the amplitude estimation algorithm.
The rest of the paper is organized as follows: The non-boolean amplitude amplification algorithm is described in Section 2 and analyzed in Section 3. Section 4 contains the description and analysis of the quantum mean estimation algorithm. Both these algorithms are demonstrated using a toy example in Section 5. Slightly modified versions of the algorithms are provided in Section 6. The tasks performed by these modified algorithms are related to, but different from, the tasks ofthe algorithms introduced in Section 2 and Section 4. Finally, the findings of this study and summarized and contextualized briefly in Section 7.
2 NON-BOOLEAN AMPLITUDE AMPLIFICATION ALGORITHM 2.1 Setup and Notation In addition to the quantum system (or qubits) that serve as inputs to the quantum oracle, the non-boolean amplitude amplification algorithm introduced in this section will use one extra ancilla qubit. For concreteness, let the quantum system used in the algorithm consist of two quantum registers. The first register contains the lone ancilla qubit, and the second register will beacted upon by the quantum oracle. The notations |푎⟩ ⊗ |푏⟩ and |푎,푏⟩ will both refer to the state where the two registers are unen- tangled, with the first register in state |푎⟩ and the second register in state |푏⟩. The tensor product notation ⊗ will also be used to combine operators that act on the individual registers into operators that simultaneously act on both registers. Such two-register operators will be represented by boldface symbols, e.g., S횿0 , U휑 , I. Likewise, boldface symbols will be used to represent the states of the two-register system in the bra–ket notation, e.g., |횿0⟩. Throughout this paper, any state written in the bra–ket notation, e.g., |휓⟩, will be unit normalized, i.e., normalized to 1. The dagger notation (†) will be used to denote the Hermitian conjugate of an operator, which is also the inverse for a unitary operator. Throughout this paper, unless otherwise specified, {|0⟩ , |1⟩ ,..., |푁 − 1⟩} will be used as the basis for (the state space of) the second register. Any measurement of the second register will refer to measurement in this basis. Likewise, unless otherwise specified, n o n o |0, 0⟩ , |0, 1⟩ ,..., |0, 푁 − 1⟩ ∪ |1, 0⟩ , |1, 1⟩ ,..., |1, 푁 − 1⟩ (13) will be used as the basis for the two-register system. Let |휓0⟩ be the initial state of the second register from which the amplification process is to 2 begin. Let 퐴0 be the unitary operator that changes the state of the second register from |0⟩ to |휓0⟩. 푁 −1 푁 −1 ∑︁ ∑︁ 2 |휓0⟩ ≡ 퐴0 |0⟩ ≡ 푎0 (푥) |푥⟩ , such that 푎0 (푥) = 1 , (14) 푥=0 푥=0 where 푎0 (푥) is the initial amplitude of the basis state |푥⟩.
2 It is implicitly assumed here that there exists a state |0⟩ which is simultaneously an eigenstate of 푈휑 , as well as a special, easy-to-prepare state of the second register. The algorithms of this paper can be modified to work even without this assumption—it is made only for notational convenience. Non-Boolean Quantum Amplitude Amplification and Quantum Mean Estimation 5
Circuit for S횿0
register 1 퐻 퐻 (ancilla) 2 |0, 0⟩⟨0, 0| − I
퐴† 퐴 register 2 0 0
Fig. 1. Quantum circuit for an implementation of S횿0 , based on (19).
As we will see shortly, the algorithm introduced in this section will initialize the ancilla in the |+⟩ state given by |0⟩ + |1⟩ |+⟩ = √ . (15) 2 Anticipating this, let the two-register state |횿0⟩ be defined as
|0,휓0⟩ + |1,휓0⟩ |횿0⟩ ≡ |+,휓0⟩ = √ (16a) 2 푁 −1 1 ∑︁ h i = √ 푎0 (푥) |0, 푥⟩ + |1, 푥⟩ . (16b) 2 푥=0 2.2 Required Unitary Operations The following unitary operations will be used in the generalized amplitude amplification algorithm of this paper:
2.2.1 Selective Phase-Flip Operator. Let the two-register unitary operator S횿0 be defined as
S횿0 ≡ 2 |횿0⟩⟨횿0| − I (17a)
= 2 |+,휓0⟩⟨+,휓0| − I , (17b) where I is the two-register identity operator. S횿0 leaves the state |횿0⟩ unchanged and flips the 푆 phase of any state orthogonal to |횿0⟩. S횿0 is simply the two-register generalization of 휓0 used in the boolean amplitude amplification algorithm. From (14) and (16), it can be seen that h i |횿0⟩ = 퐻 ⊗ 퐴0 |0, 0⟩ , (18) 퐻 where is the Hadamard transform. This allows S횿0 to be expressed as h i h i h i 퐻 ⊗ 퐴 | , ⟩⟨ , | − 퐻 ⊗ 퐴† . S횿0 = 0 2 0 0 0 0 I 0 (19)
This expression leads to an implementation of S횿0 , as depicted in Figure 1, provided one has access 퐴 퐴† to the quantum circuits that implement 0 and 0.
2.2.2 Conditional Oracle Calls. Let the two-register unitary operator U휑 be defined as 푈 푈 † . U휑 ≡ |0⟩⟨0| ⊗ 휑 + |1⟩⟨1| ⊗ 휑 (20) Its action on the basis states of the two-register system is given by +푖휑 (푥) U휑 |0, 푥⟩ = 푒 |0, 푥⟩ , (21) 6 Prasanth Shyamsundar
Circuit for U휑 register 1 푋 푋 (ancilla)
푈 † register 2 휑 푈휑
† Fig. 2. Quantum circuit for an implementation of U휑 using controlled calls to the 푈휑 and 푈휑 oracles.
† Circuit for U휑 register 1 푋 푋 (ancilla)
푈 † register 2 휑 푈휑
† † Fig. 3. Quantum circuit for an implementation of U휑 using controlled calls to the 푈휑 and 푈휑 oracles.
−푖휑 (푥) U휑 |1, 푥⟩ = 푒 |1, 푥⟩ . (22)
If the ancilla is in state |0⟩, U휑 acts 푈휑 on the second register. On the other hand, if the ancilla is in † state |1⟩, it acts 푈휑 on the second register. The inverse of U휑 is given by † 푈 † 푈 , U휑 = |0⟩⟨0| ⊗ 휑 + |1⟩⟨1| ⊗ 휑 (23) † and the action of U휑 on the basis states is given by † , 푥 푒−푖휑 (푥) , 푥 , U휑 |0 ⟩ = |0 ⟩ (24) † , 푥 푒+푖휑 (푥) , 푥 . U휑 |1 ⟩ = |1 ⟩ (25)
The amplitude amplification algorithm for non-boolean functions will involve calls toboth U휑 and † † U휑 . Figure 2 and Figure 3 depict implementations of U휑 and U휑 using a) the bit-flip (or Pauli-X) † gate 푋, and b) controlled 푈휑 and 푈휑 operations, with the ancilla serving as the control qubit. 2.3 Algorithm Description The amplitude amplification algorithm for non-boolean functions is iterative and consists ofthe following steps:
(1) Initialize the two-register system in the |횿0⟩ state. 퐾 (2) Perform iterations: During the odd iterations, apply the operation S횿0 U휑 on the system. † During the even iterations, apply S횿0 U휑 on the system. (3) After the 퐾 iterations, measure the ancilla (first register) in the 0/1 basis. Up to a certain number of iterations, the iterative steps are designed to amplify the amplitude of the basis states |0, 푥⟩ and |1, 푥⟩ with lower values of cos 휑 (푥). The measurement of the ancilla at Non-Boolean Quantum Amplitude Amplification and Quantum Mean Estimation 7
Odd iterations Even iterations 0/1 register 1 : |+⟩ ... (ignored) (ancilla) † U휑 S횿0 U휑 S횿0 ... register 2: |휓0⟩ Final state
Fig. 4. Quantum circuit for the non-boolean amplitude amplification algorithm.
Algorithm 1 Non-boolean amplitude amplification algorithm of Section 2.
1: initialize |횿⟩ := |횿0⟩ 2: for 푘 := 1 to 퐾 do 3: if 푘 is odd then
4: update |횿⟩ := S횿0 U휑 |횿⟩ 5: else † 6: update |횿⟩ := S횿0 U휑 |횿⟩ 7: end if 8: end for 9: Measure the ancilla in the 0/1 basis. the end of the algorithm is performed simply to ensure that the two registers will not be entangled in the final state of the system. The quantum circuit and the pseudocode for the algorithmare shown in Figure 4 and Algorithm 1, respectively. For pedagogical reasons, the specification of 퐾, the number of iterations to perform, has been deferred to Section 3, which contains an analysis of the algorithm.
2.4 Connection to the Boolean Amplitude Amplification Algorithm
From (20) and (23), it can be seen that for the boolean oracle case given by 휑 (푥) = 휋 푓bool (푥), U휑 and † 퐼 푈^ 푈^ U휑 both reduce to ⊗ 푓bool , where 푓bool is the oracle used in the boolean amplitude amplification algorithm. Furthermore, if the first register is in the |+⟩ state, from (3) and (17), the action of S횿0 is given by h i h i 휓 푆 휓 . S횿0 |+⟩ ⊗ | ⟩ = |+⟩ ⊗ 휓0 | ⟩ (26) Note that the first register is unaffected here. Thus, for the boolean oracle case, Algorithm 1 reduces 푆 푈^ to simply acting 휓0 푓bool on the second register during each iteration—the ancilla qubit remains untouched and unentangled from the second register. In this way, the algorithm presented in this section is a generalization of the boolean amplitude amplification algorithm described in Section 1. The two key differences of the generalized algorithm from the boolean one, apart from theusage of a non-boolean oracle, are (1) The addition of the ancilla, which doubles the dimension of the state space of the system, and † (2) Alternating between using U휑 and U휑 during the odd and even iterations. The motivation for these modifications will be provided in Section 3.1 and Section 3.2, respectively. 8 Prasanth Shyamsundar
3 ANALYSIS OF THE NON-BOOLEAN AMPLITUDE AMPLIFICATION ALGORITHM
Let |횿푘 ⟩ be the state of the two-register system after 푘 = 0, 1, . . . , 퐾 iterations of the amplitude amplification algorithm (but before the measurement of the ancilla). For 푘 > 0, |횿푘 ⟩ can be recursively written as S U |횿 ⟩ , if 푘 is odd , 횿0 휑 푘−1 |횿푘 ⟩ ≡ (27) † | ⟩ , 푘 . S횿0 U휑 횿푘−1 if is even Let 푎˜푘 (0, 푥) and 푎˜푘 (1, 푥) be the normalized amplitudes of the basis states |0, 푥⟩ and |1, 푥⟩, respec- tively, in the superposition |횿푘 ⟩. 푁 ∑︁ h i |횿푘 ⟩ ≡ 푎˜푘 (0, 푥) |0, 푥⟩ + 푎˜푘 (1, 푥) |1, 푥⟩ . (28) 푥=0
In the initial state |횿0⟩, the amplitudes 푎˜0 (0, 푥) and 푎˜0 (1, 푥) are both given, from (16), by
푎0 (푥) 푎˜0 (0, 푥) = 푎˜0 (1, 푥) = √ . (29) 2 Let the parameter 휃 ∈ [0, 휋] be implicitly defined by 푁 −1 ∑︁ 2 cos(휃) ≡ 푎0 (푥) cos 휑 (푥) . (30) 푥=0 cos(휃) is the expected value of cos 휑 (푥) over bitstrings 푥 sampled by measuring the state |휓0⟩. Let the two-register states |휶 ⟩ and |휷⟩ be defined as
|휶 ⟩ ≡ U휑 |횿0⟩ , (31) † . |휷⟩ ≡ U휑 |횿0⟩ (32) They will be used to track the evolution of the system through the iterative steps of the algorithm. Using (16), (20), and (23), |휶 ⟩ and |휷⟩ can be written as 푁 −1 1 ∑︁ h 푖휑 (푥) −푖휑 (푥) i |휶 ⟩ = √ 푎0 (푥) 푒 |0, 푥⟩ + 푒 |1, 푥⟩ , (33) 2 푥=0 푁 −1 1 ∑︁ h −푖휑 (푥) 푖휑 (푥) i |휷⟩ = √ 푎0 (푥) 푒 |0, 푥⟩ + 푒 |1, 푥⟩ . (34) 2 푥=0
Note that 휃, |휶 ⟩, and |휷⟩ are all implicitly dependent on the function 휑 and the initial state |휓0⟩. For notational convenience, these dependencies are not explicitly indicated.
3.1 The First Iteration
After one iterative step, the system will be in state |횿1⟩ given by . |횿1⟩ = S횿0 U휑 |횿0⟩ (35) Using (17) and (31), this can be written as . |횿1⟩ = S횿0 |휶 ⟩ = 2 ⟨횿0 | 휶 ⟩ |횿0⟩ − |휶 ⟩ (36) From (16), (30), and (33), 푁 −1 1 ∑︁ 2 h 푖휑 (푥) −푖휑 (푥) i ⟨횿0 | 휶 ⟩ = 푎0 (푥) 푒 ⟨0, 푥 | 0, 푥⟩ + 푒 ⟨1, 푥 | 1, 푥⟩ (37a) 2 푥=0 Non-Boolean Quantum Amplitude Amplification and Quantum Mean Estimation 9
푁 −1 1 ∑︁ 2 h 푖휑 (푥) −푖휑 (푥) i = 푎0 (푥) 푒 + 푒 (37b) 2 푥=0 푁 −1 1 ∑︁ 2 = 푎0 (푥) 2 cos 휑 (푥) = cos(휃) . (37c) 2 푥=0
Note that ⟨횿0 | 휶 ⟩ is real-valued. This fact is crucial to the functioning of the algorithm, as we will see later in this subsection. The motivation behind adding an ancilla qubit, effectively doubling the number of basis states, is precisely to make ⟨횿0 | 휶 ⟩ real-valued. From (36) and (37), |횿1⟩ can be written as
|횿1⟩ = 2 cos(휃) |횿0⟩ − |휶 ⟩ . (38)
From (16) and (33), the amplitude 푎˜1 (0, 푥) of the basis state |0, 푥⟩ in the superposition |횿1⟩ can be written as 푎 푥 0 ( ) h 푖휑 (푥) i 푎˜1 (0, 푥) = ⟨0, 푥 | 횿1⟩ = √ 2 cos(휃) − 푒 . (39) 2 Likewise, the amplitude 푎˜1 (1, 푥) of the basis state |1, 푥⟩ can be written as 푎 푥 0 ( ) h −푖휑 (푥) i 푎˜1 (1, 푥) = ⟨1, 푥 | 횿1⟩ = √ 2 cos(휃) − 푒 . (40) 2 From (39) and (40), it can be seen that after one iterative step, the amplitudes of |0, 푥⟩ and |1, 푥⟩ have acquired factors of 2 cos(휃) − 푒푖휑 (푥) and 2 cos(휃) − 푒−푖휑 (푥) , respectively. Now, 2 2 푎˜1 (0, 푥) 푎˜1 (1, 푥) = = 4 cos2 (휃) + 1 − 4 cos(휃) cos 휑 (푥) . (41) 2 2 푎˜0 (0, 푥) 푎˜0 (1, 푥) This shows that if cos(휃) is positive, the magnitude of the “amplitude amplification factor” after one iteration is monotonically decreasing in cos(휑). This preferential amplification of states with lower values of cos(휑) is precisely what the algorithm set out to do. Note that this monotonicity property relies crucially on ⟨횿0 | 휶 ⟩ being real-valued in (36). If ⟨횿0 | 휶 ⟩ is complex, with a phase 훿 ∉ {0, 휋}, then the amplification will be monotonic in cos(휑 −훿), which does not meet the present goal of the algorithm. The case where ⟨횿0 | 휶 ⟩ is not real-valued is explored further in Section 6.
3.2 Identities to Track the Subsequent Iterations Equations (16), (17), (20), (23), (31), and (32) can be used to derive the following identities, which † capture the actions of the operators S횿0 , U휑 , and U휑 on the states |횿0⟩, |휶 ⟩, and |휷⟩: , S횿0 |횿0⟩ = |횿0⟩ (42) 휃 , S횿0 |휶 ⟩ = 2 cos( ) |횿0⟩ − |휶 ⟩ (43) 휃 , S횿0 |휷⟩ = 2 cos( ) |횿0⟩ − |휷⟩ (44)
U휑 |횿0⟩ = |휶 ⟩ , (45) 푁 −1 1 ∑︁ h 2푖휑 (푥) −2푖휑 (푥) i U휑 |휶 ⟩ = √ 푎0 (푥) 푒 |0, 푥⟩ + 푒 |1, 푥⟩ , (46) 2 푥=0 U휑 |휷⟩ = |횿0⟩ , (47) † , U휑 |횿0⟩ = |휷⟩ (48) † , U휑 |휶 ⟩ = |횿0⟩ (49) 10 Prasanth Shyamsundar
odd iterations
Subspace spanned Subspace spanned by |횿0⟩ and |휷⟩ by |횿0⟩ and |휶 ⟩
even iterations
Fig. 5. Illustration depicting the evolution of the state of two-register system through the iterations of the non-boolean amplitude amplification algorithm.
1 푁 −1 h i † ∑︁ 푎 푥 푒−2푖휑 (푥) , 푥 푒2푖휑 (푥) , 푥 . U휑 |휷⟩ = √ 0 ( ) |0 ⟩ + |1 ⟩ (50) 2 푥=0
We can see that the subspace spanned by the states |횿0⟩, |휶 ⟩, and |휷⟩ is almost stable under the † † action of S횿0 , U휑 , and U휑 . Only the actions of U휑 on |휶 ⟩ and U휑 on |휷⟩ can take the state of the † system out of this subspace. The motivation behind alternating between using U휑 and U휑 during the odd and the even iterations is to keep the state of the system within the subspace spanned by |횿0⟩, |휶 ⟩, and |휷⟩. From the identities above, we can write the following expressions capturing the relevant actions † of the odd iteration operator S횿0 U휑 and the even iteration operator S횿0 U휑 :
휃 , S횿0 U휑 |횿0⟩ = 2 cos( ) |횿0⟩ − |휶 ⟩ (51) , S횿0 U휑 |휷⟩ = |횿0⟩ (52) † 휃 , S횿0 U휑 |횿0⟩ = 2 cos( ) |횿0⟩ − |휷⟩ (53) † . S횿0 U휑 |휶 ⟩ = |횿0⟩ (54)
From these expressions, it can be seen that the odd iteration operator S횿0 U휑 maps any state in the space spanned by |횿0⟩ and |휷⟩ to a state in the space spanned by |횿0⟩ and |휶 ⟩. Conversely, the † even iteration operator S횿0 U휑 maps any state in the space spanned by |횿0⟩ and |휶 ⟩ to a state in the space spanned by |횿0⟩ and |휷⟩. Since the algorithm begins with the system initialized in the state |횿0⟩, it can be seen that the state of the system oscillates between the two subspaces during the odd and even iterations, as depicted in Figure 5.
3.3 State After 푘 Iterations
Using (27) and (51–54), the state |횿푘 ⟩ of the two-register system after 푘 ≥ 0 iterations can be written, in matrix multiplication notation, as
푘 h i 2 cos(휃) 1 1 |횿0⟩ |휶 ⟩ , if 푘 is odd , −1 0 0 |횿푘 ⟩ = (55) 푘 h i 2 cos(휃) 1 1 |횿0⟩ |휷⟩ , if 푘 is even . −1 0 0 Non-Boolean Quantum Amplitude Amplification and Quantum Mean Estimation 11
As shown in Appendix A,(55) can be simplified to 1 h i sin (푘 + 1)휃 |횿 ⟩ − sin(푘휃) |휶 ⟩ , if 푘 is odd , sin(휃) 0 |횿푘 ⟩ = (56) 1 h i sin (푘 + 1)휃 |횿 ⟩ − sin(푘휃) |휷⟩ , if 푘 is even . sin(휃) 0 3.4 Basis State Amplitudes After 푘 Iterations
From (16), (33), (34), and (56), the amplitudes 푎˜푘 (0, 푥) of the basis states |0, 푥⟩ after 푘 ≥ 0 iterations can be written as
푎0 (푥) h i √ sin (푘 + 1)휃 − sin(푘휃)푒푖휑 (푥) , if 푘 is odd , 휃 2 sin( ) 푎˜푘 (0, 푥) = ⟨0, 푥 | 횿푘 ⟩ = (57) 푎0 (푥) h i √ sin (푘 + 1)휃 − sin(푘휃)푒−푖휑 (푥) , if 푘 is even . 휃 2 sin( ) Similarly, the amplitudes 푎˜푘 (1, 푥) of the basis states |1, 푥⟩ can be written as
푎0 (푥) h i √ sin (푘 + 1)휃 − sin(푘휃)푒−푖휑 (푥) , if 푘 is odd , 휃 2 sin( ) 푎˜푘 (1, 푥) = ⟨1, 푥 | 횿푘 ⟩ = (58) 푎0 (푥) h i √ sin (푘 + 1)휃 − sin(푘휃)푒푖휑 (푥) , if 푘 is even . 휃 2 sin( ) These expressions can be summarized, for 푏 ∈ {0, 1}, as
푎0 (푥) h i √ sin (푘 + 1)휃 − sin(푘휃)푒푖휑 (푥) , if 푘 + 푏 is odd , 휃 2 sin( ) 푎˜푘 (푏, 푥) = (59) 푎0 (푥) h i √ sin (푘 + 1)휃 − sin(푘휃)푒−푖휑 (푥) , if 푘 + 푏 is even . 휃 2 sin( ) Amplitudes After Ancilla Measurement. Note that the magnitudes of the amplitudes of the states |0, 푥⟩ and |1, 푥⟩ are equal, i.e.,
푎˜푘 (0, 푥) = 푎˜푘 (1, 푥) , (60) for all 푘 ≥ 0 and 푥 ∈ {0, 1, . . . , 푁 −1}. So, a measurement of the ancilla qubit in the first register after
퐾 iterations will yield a value of either 0 or 1 with equal probability. Let 휓퐾,푏 be the normalized state of the second register after performing 퐾 iterations, followed by a measurement of the ancilla qubit, which yields a value 푏 ∈ {0, 1}. 휓퐾,푏 can be written as 푁 −1 ∑︁ 휓퐾,푏 = 푎퐾,푏 (푥) |푥⟩ , (61) 푥=0 where 푎퐾,푏 (푥) are the normalized amplitudes of the basis states of the second register (after performing 퐾 iterations and the measurement of the ancilla). 푎퐾,푏 (푥) is simply given by √ 푎퐾,푏 (푥) = 2 푎˜퐾 (푏, 푥) . (62) Much of the following discussion holds a) regardless of whether or not a measurement is performed on the ancilla qubit after the 퐾 iterations, and b) regardless of the value yielded by the ancilla measurement (if performed)—the primary goal of measuring the ancilla is simply to make the two registers unentangled from each other. 12 Prasanth Shyamsundar
3.5 Basis State Probabilities After 퐾 Iterations
Let 푝퐾 (푥) be the probability for a measurement of the second register after 퐾 ≥ 0 iterations to yield 푥. It can be written in terms of the amplitudes in Section 3.4 as h 2 2i 2 2 푝퐾 (푥) = 푎˜퐾 (0, 푥) + 푎˜퐾 (1, 푥) = 푎퐾,0 (푥) = 푎퐾,1 (푥) . (63)
This expression shows that the probability 푝퐾 (푥) depends neither on whether the ancilla was measured, nor on the result of the ancilla measurement (if performed). From (59), 푝퐾 (푥) can be written as 푝 푥 2 0 ( ) 푖휑 (푥) 푝퐾 (푥) = sin (퐾 + 1)휃 − sin(퐾휃)푒 (64) sin2 (휃) 푝0 (푥) h i = sin2 (퐾휃) + sin2 (퐾 + 1)휃 − 2 sin(퐾휃) sin (퐾 + 1)휃 cos 휑 (푥) . (65) sin2 (휃) It can be seen here that the probability amplification factor 푝퐾 (푥)/푝0 (푥) is monotonic in cos 휑 (푥) for all 퐾 ≥ 0. The following trigonometric identities, proved in Appendix B, help elucidate the 퐾 dependence of this amplification factor: sin2 (퐶) + sin2 (퐶 + 퐷) = sin2 (퐷) + 2 sin(퐶) sin(퐶 + 퐷) cos(퐷) , (66) 2 sin(퐶) sin(퐶 + 퐷) = cos(퐷) − cos(2퐶 + 퐷) . (67) Setting 퐶 = 퐾휃 and 퐷 = 휃, these identities can be used to rewrite (65) as n h io 푝퐾 (푥) = 푝0 (푥) 1 − 휆퐾 cos 휑 (푥) − cos(휃) , (68) where the 퐾-dependent factor 휆퐾 is given by 2 sin(퐾휃) sin (퐾 + 1)휃 cos(휃) − cos (2퐾 + 1)휃 휆퐾 ≡ = . (69) sin2 (휃) sin2 (휃)
For notational convenience, the fact that 휆퐾 depends on 휃 is not explicitly indicated. The result in (68) can be summarized as follows: • Applying 퐾 iterations of the non-boolean amplitude amplification algorithm changes the probability of measuring 푥 by a factor that is a linear function of cos 휑 (푥). If the second register is initially in an equiprobable state, i.e., if 푝0 (푥) = constant, then the probability 푝퐾 (푥) after 퐾 iterations is itself a linear function of cos 휑 (푥) . • If cos 휑 (푥) = cos(휃) for some 푥, the probability of a measurement of the second register yielding that 푥 is unaffected by the algorithm. • The slope of the linear dependence is −휆퐾 . – If 휆퐾 is positive, the states with cos(휑) < cos(휃) are amplified. Conversely, if 휆퐾 is negative, states with cos(휑) > cos(휃) are amplified. – The magnitude of 휆퐾 controls the degree to which the preferential amplification has been performed. 2 From (69), it can be seen that 휆퐾 is an oscillatory function of 퐾, centered around cos(휃)/sin (휃), with an amplitude of 1/sin2 (휃) and a period of 휋/휃. Recalling from (30) that
푁 −1 푁 −1 ∑︁ ∑︁ 푝0 (푥) cos 휑 (푥) = cos(휃) = 푝0 (푥) cos(휃) , (70) 푥=0 푥=0 one can verify that for any 퐾 ≥ 0, the probabilities 푝퐾 (푥) from (68) add up to 1. Non-Boolean Quantum Amplitude Amplification and Quantum Mean Estimation 13
From the definition of 휆퐾 in (69), it can be seen that for all 퐾, 휆퐾 is bounded from above by 휆optimal defined as cos(휃) + 1 1 휆퐾 ≤ 휆optimal ≡ = . (71) sin2 (휃) 1 − cos(휃) The 휆퐾 = 휆optimal case represents the maximal preferential amplification of lower values of cos(휑) achievable by the algorithm. Let 푝optimal (푥) be the state probability function corresponding to 휆퐾 = 휆optimal. From (68), cos 휑 (푥) − cos(휃) 푝 (푥) = 푝 (푥) 1 − . (72) optimal 0 1 − cos(휃) It is interesting to note that 푝optimal (푥) = 0 for inputs 푥 with the highest possible value of cos 휑 (푥) , namely 1. In other words, 푝optimal reaches the limit set by the non-negativity of probabilities, in the context of the algorithm under consideration.
3.6 Number of Iterations to Perform In the description of the algorithm in Section 2, the number of iterations 퐾 to perform was left unspecified. Armed with (69), this aspect of the algorithm can now be tackled. Higher values of 휆퐾 are preferable for the purposes of this paper, namely to preferentially amplify lower values of cos(휑). From (69), it can be seen that 휆퐾 is monotonically increasing for 퐾 = 0, 1,... as long as 0 ≤ (2퐾 + 1)휃 ≤ 휋 + 휃 or, equivalently, for j 휋 k 0 ≤ 퐾 ≤ , (73) 2휃 where ⌊푣⌋ denotes the floor of 푣. As with the boolean amplitude amplification algorithm of Ref. [5], a good approach is to stop the algorithm just before the first iteration that, if performed, would cause value of 휆퐾 to decrease (from its value after the previous iteration). This leads to the choice 퐾˜ for the number of iterations to perform, given by j 휋 k 퐾˜ = . (74) 2휃
The corresponding value of 휆퐾 for 퐾 = 퐾˜ is given by 1 h j 휋 k i 휆 ˜ = cos(휃) − cos 2휃 + 휃 . (75) 퐾 sin2 (휃) 2휃 The choice 퐾˜ in (74) for the number of iterations offers an amplification iff 휋 > 2휃 > 0 or, 휃 휃 휋 휆 equivalently, iff 0 < cos( ) < 1. At one of the extremes, namely = /2, we have 퐾˜ = 0. The other extreme, namely cos(휃) = 1, corresponds to every state 푥 with a non-zero amplitude in the initial state |휓0⟩ having cos 휑 (푥) = 1; there is no scope for preferential amplification in this case. 휆 휆 휋 휃 From (75), it can be seen that 퐾˜ exactly equals optimal defined in (71) if /(2 ) is a half-integer. In terms of 휃, this condition can be written as n휋 휋 휋 o 휃 ∈ , , ,... (harmonic progression) ⇒ 휆 ˜ = 휆 . (76) 3 5 7 퐾 optimal 휃 휆 For generic values of , from (75), it can be seen that 퐾˜ satisfies 2 cos(휃) cos(휃) + 1 ≤ 휆 ˜ ≤ 휆optimal = . (77) sin2 (휃) 퐾 sin2 (휃) This can be rewritten as h i 휆 2 휃 휆 휆 , optimal 1 − tan ( /2) ≤ 퐾˜ ≤ optimal (78) 14 Prasanth Shyamsundar using the following identity: h i 2 휃 2 휃 2 cos(휃) 2 cos ( /2) − sin ( /2) = = 1 − tan2 (휃/2) . (79) cos(휃) + 1 2 cos2 (휃/2) − 1 + 1 휃 휆 휆 휃 2 From (78), it can be seen that for small , 퐾˜ is approximately equal to optimal, within an O( ) relative error.
3.7 Mean and Higher Moments of cos(휑) After 퐾 Iterations 휇 (푛) 푛 휑 (푥) 푥 Let 퐾 be the -th raw moment of cos for a random value of sampled by measuring the second register after 퐾 iterations. 푁 −1 ∑︁ 휇 (푛) ≡ 푝 (푥) 푛 휑 (푥) . 퐾 퐾 cos (80) 푥=0 휇 (1) (휃) 휇 (푛) Under this notation, 0 is simply cos . From (68), we can write 퐾 in terms of the initial moments (퐾 = 0) as 푁 −1 ∑︁ h h ii 휇 (푛) 푝 (푥) 푛 휑 (푥) − 휆 휑 (푥) − (휃) 퐾 = 0 cos 1 퐾 cos cos (81a) 푥=0 h i 휇 (푛) 휆 휇 (푛+1) 휇 (푛) 휇 (1) . = 0 − 퐾 0 − 0 0 (81b) 휇 휎2 휑 푥 In particular, let 퐾 and 퐾 represent the expected value and variance, respectively, of cos ( ) after 퐾 iterations. 휇 ≡ 휇 (1) , 퐾 퐾 (82) h i2 휎2 ≡ 휇 (2) − 휇 (1) . 퐾 퐾 퐾 (83) Now, the result in (81) for 푛 = 1 can be written as 휇 휇 휆 휎2 . 퐾 − 0 = − 퐾 0 (84) For 휆퐾 > 0, this equation captures the reduction in the expected value of cos 휑 (푥) resulting from 퐾 iterations of the algorithm.
3.8 Cumulative Distribution Function of cos(휑) After 퐾 Iterations 퐹 cos 푦 휑 푥 푦 푥 Let 퐾 ( ) be the probability that cos ( ) ≤ , for an sampled as per the probability distribution 푝 퐹 cos 휑 퐾 퐾 . 퐾 is the cumulative distribution function of cos( ) for a measurement after iterations, and can be written as 푁 −1 h i 퐹 cos 푦 ∑︁ 푝 푥 1 푦 휑 푥 , 퐾 ( ) = 퐾 ( ) [0,∞) − cos ( ) (85) 푥=0 푁 −1 h i 퐹 cos 푦 ∑︁ 푝 푥 1 푦 휑 푥 , 1 − 퐾 ( ) = 퐾 ( ) 1 − [0,∞) − cos ( ) (86) 푥=0 where 1[0,∞) is the Heaviside step function, which equals 0 when its argument is negative and 1 when its argument is non-negative. Using the expression for 푝퐾 in (68), these can be written as 푁 −1 n o 퐹 cos 푦 퐹 cos 푦 휆 휇 휆 ∑︁ 푝 푥 휑 푥 1 푦 휑 푥 , 퐾 ( ) = 0 ( ) 1 + 퐾 0 − 퐾 0 ( ) cos ( ) [0,∞) − cos ( ) (87) 푥=0 Non-Boolean Quantum Amplitude Amplification and Quantum Mean Estimation 15
퐹 cos 푦 퐹 cos 푦 휆 휇 1 − 퐾 ( ) = 1 − 0 ( ) 1 + 퐾 0 푁 −1 (88) ∑︁ n h io − 휆퐾 푝0 (푥) cos 휑 (푥) 1 − 1[0,∞) 푦 − cos 휑 (푥) . 푥=0 Every 푥 that provides a non-zero contribution to the summation in (87) satisfies cos 휑 (푥) ≤ 푦. This fact can be used to write 휆 퐹 cos 푦 퐹 cos 푦 휆 휇 푦 . 퐾 ≥ 0 ⇒ 퐾 ( ) ≥ 0 ( ) 1 + 퐾 0 − (89)
Likewise, every 푥 that provides a non-zero contribution to the summation in (88) satisfies cos 휑 (푥) > 푦. This can be used to write 휆 퐹 cos 푦 퐹 cos 푦 휆 휇 푦 . 퐾 ≥ 0 ⇒ 1 − 퐾 ( ) ≤ 1 − 0 ( ) 1 + 퐾 0 − (90)
The inequalities in (89) and (90) can be summarized as n o 휆 퐹 cos 푦 퐹 cos 푦 휆 퐹 cos 푦 휇 푦, 퐹 cos 푦 푦 휇 , 퐾 ≥ 0 ⇒ 푘 ( ) ≥ 0 ( ) + 퐾 max 0 ( ) 0 − 1 − 0 ( ) − 0 (91) where the max function represents the maximum of its two arguments. This equation provides a lower bound on the probability that a measurement after 퐾 iterations yields a state whose cos(휑) value is no higher than 푦. It may be possible to derive stronger bounds (or even the exact expression) 퐹 cos 푦 휑 푦 휇 for 퐾 ( ) if additional information is known about the initial distribution of cos( ). For ≤ 0, the first argument of the max function in (91) will be active, and for 푦 ≥ 휇0, the second argument will be active. For the 휆퐾 ≤ 0 case, it can similarly be shown that n o 휆 퐹 cos 푦 퐹 cos 푦 휆 퐹 cos 푦 휇 푦, 퐹 cos 푦 푦 휇 , 퐾 ≤ 0 ⇒ 퐾 ( ) ≤ 0 ( ) + 퐾 min 0 ( ) 0 − 1 − 0 ( ) − 0 (92) where the min function represents the minimum of its two arguments.
3.9 Boolean Oracle Case The result in Section 3.6 for the heuristic choice for the number of iterations, namely 퐾˜ = ⌊휋/(2휃)⌋, might be reminiscent of the analogous result for the boolean amplitude amplification algorithm in Ref. [5], namely ⌊휋/(4휃푎)⌋. The similarity between the two results is not accidental. To see this, 휃 휃 푃 good consider the parameter in the boolean oracle case, say bool. Let 0 be the probability for a measurement on the initial state |휓0⟩ to yield a winning state. From (30), h i h i 휃 푃 good 푃 good 푃 good , cos( bool) = −1 × 0 + 1 × 1 − 0 = 1 − 2 0 (93) 2 휃 푃 good . ⇒ sin ( bool/2) = 0 (94) Thus, in the boolean oracle case • sin2 (휃/2) reduces to the initial probability of “success” (measuring a winning state), which 2 is captured by sin (휃푎) in Ref. [5], and • The parameter 휃 used in this paper reduces to the parameter 2휃푎 used in Ref. [5], and ⌊휋/(2휃)⌋ reduces to ⌊휋/(4휃푎)⌋. In this way, the results of Section 3 in general, and Section 3.6 in particular, can be seen as generalizations of the corresponding results in Ref. [5]. 16 Prasanth Shyamsundar
Qiter (single iteration) 0/1 register 1 : |+⟩ 푋 ... (ignored) (ancilla)
U휑 S횿0 ... register 2: |휓0⟩ Final state
Fig. 6. Quantum circuit for the alternative formulation, in Section 3.10, of the non-boolean amplitude amplification algorithm.
Algorithm 2 Alternative formulation, in Section 3.10, of the non-boolean amplitude amplification algorithm.
1: initialize |횿⟩ := |횿0⟩ 2: for 푘 := 1 to 퐾 do 푋 퐼 3: update |횿⟩ := S횿0 U휑 [ ⊗ ] |횿⟩ 4: end for 5: Measure the ancilla in the 0/1 basis.
3.10 Alternative Formulation of the Algorithm In the formulation of the non-boolean amplitude amplification algorithm in Section 2, an ancilla qubit (first register) was included solely for the purpose of making the quantity 횿0 U휑 횿0 =
⟨횿0 | 휶 ⟩ real-valued. If, in a particular use case, it is guaranteed that 휓0 푈휑 휓0 will be real-valued (or have a negligible imaginary part3) even without introducing the ancilla, then the algorithm 푆 푈 described in Section 2 can be used without the ancilla: alternate between applying 휓0 휑 during the 푆 푈 † odd iterations and 휓0 휑 during the even iterations. In other words, the properties and structure of two-register system were not exploited in the algorithm description, beyond making 횿0 U휑 횿0 real-valued. † However, from (33) and (34), it can be seen that the states |휶 ⟩ = U휑 |횿0⟩ and |휷⟩ = U휑 |횿0⟩ are related by |휷⟩ = [푋 ⊗ 퐼] |휶 ⟩ , |휶 ⟩ = [푋 ⊗ 퐼] |휷⟩ , (95) where 푋 is the bit-flip or the Pauli-X operator. This can be exploited to avoid having twoseparate cases—푘 being odd and even—in the final expression for |횿푘 ⟩ in (56). The expression for both cases can be made the same by acting the Pauli-X gate on the ancilla, once at the end, if the total number of iterations is even. More interestingly, the relationship between |휶 ⟩ and |휷⟩ can be used to avoid having two different operations in the first place, for the odd and even iterations. This leads to the following alternative formulation of the non-boolean amplitude amplification algorithm: During each iteration, oddor even, act the same operator Qiter defined by 푋 퐼 . Qiter ≡ S횿0 U휑 [ ⊗ ] (96) This alternative formulation is depicted as a circuit in Figure 2 and as a pseudocode in Algorithm 2.
3This could be achieved, e.g, by replacing the function 휑 (푥) with 휑′ (푥) = 푟 (푥)휑 (푥), where 푟 : {0, 1, . . . 푁 −1} → {−1, +1} is a random function independent of 휑 (푥), with mean 0 (for 푥 sampled by measuring |휓0 ⟩). Non-Boolean Quantum Amplitude Amplification and Quantum Mean Estimation 17
From (51), (52), and (95), the action of Qiter on |횿0⟩ and |휶 ⟩ can be derived as follows: 휃 , Qiter |횿0⟩ = S횿0 U휑 |횿0⟩ = 2 cos( ) |횿0⟩ − |휶 ⟩ (97) . Qiter |휶 ⟩ = S횿0 U휑 |휷⟩ = |횿0⟩ (98) alt 푘 Let 횿푘 be the state of the two-register system after iterations under this alternative formulation (before any measurement of the ancilla). alt 푘 . 횿푘 ≡ Qiter |횿0⟩ (99) alt 푘 Using similar manipulations as in Appendix A, 횿푘 can be expressed, for all ≥ 0, as alt 1 h i 횿 = sin (푘 + 1)휃 |횿0⟩ − sin(푘휃) |휶 ⟩ . (100) 푘 sin(휃) alt Note that this expression for 횿푘 is almost identical to the expression for |횿푘 ⟩ in (56), but without two separate cases for the odd and even values of 푘. Much of the analysis of the original formulation of the algorithm in Section 3 holds for the alternative formulation as well, including the expressions 푝 (푥) 휇 휇 (푛) for the state probabilities 퐾 , mean 퐾 , raw moments 퐾 , and the cumulative distribution 퐹 cos function 퐾 . In addition to simplifying the amplification algorithm (by using the same operation for every iteration), the Qiter operator used in this subsection allows for a clearer presentation of the quantum mean estimation algorithm, which will be introduced next.
4 QUANTUM MEAN ESTIMATION ALGORITHM The goal of the quantum mean estimation algorithm is to estimate the expected value of 푒푖휑 (푥) for 푥 휓 퐸 푒푖휑 sampled by measuring a given superposition state | 0⟩. Let 휓0 denote this expected value. 푁 −1 퐸 푒푖휑 휓 푈 휓 ∑︁ 푎 푥 2 푒푖휑 (푥) . 휓0 ≡ 0 휑 0 = 0 ( ) (101) 푥=0 This can be written as h i h i 퐸 푒푖휑 퐸 푒푖휑 푖 퐸 푒푖휑 , 휓0 = Re 휓0 + Im 휓0 (102) where the real and imaginary parts are given by h i 푁 −1 퐸 푒푖휑 ∑︁ 푎 푥 2 휑 푥 , Re 휓0 = 0 ( ) cos ( ) (103) 푥=0 h i 푁 −1 퐸 푒푖휑 ∑︁ 푎 푥 2 휑 푥 . Im 휓0 = 0 ( ) sin ( ) (104) 푥=0 The mean estimation can therefore be performed in two parts—one for estimating the mean of cos(휑), and the other for estimating the mean of sin(휑). Note that the expectation of cos(휑) under the state |휓0⟩ is precisely cos(휃) defined in (30).
4.1 Estimating the Mean of cos(휑)
The connection shown in Section 3.9 between the parameter 휃 and the parameter 휃푎 used in Ref. [5] serves as the intuition behind the quantum mean estimation algorithm of this paper. In 4 the amplitude estimation algorithm of Ref. [5], the parameter 휃푎 is estimated using QPE. The estimate for 휃푎 is then turned into an estimate for the initial winning probability. Likewise, here
4 The estimation of 휃푎 is only (needed to be) performed up to a two-fold ambiguity of {휃푎, 휋 − 휃푎 }. 18 Prasanth Shyamsundar the basic idea is to estimate5 the parameter 휃 defined in (30) using QPE. The estimate for 휃 can then be translated into an estimate for the initial expected value of cos 휑 (푥), namely cos(휃). The rest of this subsection will actualize this intuition into a working algorithm. 6 The key observation is that |횿0⟩ can be written as
|휼+⟩ − |휼−⟩ |횿0⟩ = √ , (105) 2 where |휼+⟩ and |휼−⟩ are given by ±푖휃 푒 |횿0⟩ − |휶 ⟩ |휼±⟩ = √ . (106) 푖 2 sin(휃)
The expressions for |휼+⟩ and |휼−⟩ in (106) can be used to verify (105). Crucially, |휼+⟩ and |휼−⟩ are 푖휃 −푖휃 unit normalized eigenstates of the unitary operator Qiter, with eigenvalues 푒 and 푒 , respectively. ±푖휃 Qiter |휼±⟩ = 푒 |휼±⟩ , (107)
⟨휼± | 휼±⟩ = 1 . (108)
The properties of |휼+⟩ and |휼−⟩ in (107) and (108) can be verified using (97), (98), and (106), as shown in Appendix C. The observations in (105) and (107) lead to the following algorithm for estimating cos(휃): (1) Perform the QPE algorithm with • the two-register operator Qiter serving the role of the unitary operator under consideration, and • the superposition state |횿0⟩ in place of the eigenstate required by the QPE algorithm as input. Let the output of this step, appropriately scaled to be an estimate of the phase angle in the range [0, 2휋), be 휔^. 휔 휃 퐸 푒푖휑 7 (2) Return cos ^ as the estimate for cos( ), i.e., the real part of 휓0 .
Proof of correctness of the algorithm: |횿0⟩ is a superposition of the eigenstates |휼+⟩ and |휼−⟩ of the unitary operator Qiter. This implies that 휔^ will either be an estimate for the phase angle of |휼+⟩, 8,9,10 namely 휃, or an estimate for the phase angle of |휼−⟩, namely 2휋 −휃. Since, cos(2휋 −휃) = cos(휃), it follows that cos 휔^ is an estimate for cos(휃).
4.2 Estimating the Mean of 푒푖휑 The algorithm for estimating the expected value of cos(휑) in the previous subsection can be re-purposed to estimate the expected value of sin(휑) by using the fact that sin(휑) = cos(휑 − 휋/2) . (109)
5The estimation of 휃 is only (needed to be) performed up to a two-fold ambiguity of {휃, 2휋 − 휃 }. 6 The forms of the eigenstates |휼+ ⟩ and |휼− ⟩ in (106) can be guessed from the form of the matrix 푆휃 in Appendix A. They can also be guessed from (100), by rewriting the sin functions in terms of complex exponential functions. 7 If the circuit implementation of Qiter is wrong by an overall (state independent) phase 휙err, then the estimate for cos(휃) is cos(휔^ − 휙err). This is important, for example, if the operation 2 |0, 0⟩⟨0, 0| − I is only implemented up to a factor of −1, i.e., with 휙err = 휋. Note that the final state probabilities under the non-boolean amplitude amplification algorithm are unaffected by such an overall phase error. 8 If 휃 = 0, the phase angle being estimated is 0 for both |휼+ ⟩ and |휼− ⟩. 9For 휃 ≠ 0, 휔^ will be an estimate for either 휃 or 2휋 − 휃 with equal probability, but this detail is not important. 10Since 휃 lies in [0, 휋 ] and 2휋 − 휃 lies in [휋, 2휋 ], the output 휔^ can be converted into an estimate for 휃 alone. But this is not necessary. Non-Boolean Quantum Amplitude Amplification and Quantum Mean Estimation 19
Circuit for U휑−휋/2
register 1 푅휋/2 푋 푅−휋/2 푋 (ancilla) U휑
register 2
Fig. 7. Quantum circuit for an implementation of U휑−휋/2 using U휑 .
퐸 푒푖휑 퐸 푒푖 (휑−휋/2) In other words, the imaginary part of 휓0 is the real part of 휓0 . By using the oracle U휑−휋/2 (for the function 휑 − 휋/2), instead of U휑 , in the mean estimation algorithm of Section 4.1, 퐸 푒푖휑 퐸 푒푖휑 the imaginary part of 휓0 can also be estimated. This completes the estimation of 휓0 . For concreteness, U휑−휋/2 can be explicitly written as 푒−푖휋/2 푈 푒푖휋/2 푈 † . U휑−휋/2 = |0⟩⟨0| ⊗ 휑 + |1⟩⟨1| ⊗ 휑 (110)
An implementation of U휑−휋/2 using the oracle U휑 , the bit-flip operator 푋, and the phase-shift operator 푅휙 is shown in Figure 7. Note that the algorithm does not, in any way, use the knowledge that {|0⟩ ,..., |푁 − 1⟩} is an eigenbasis of 푈휑 . So, this algorithm can be used to estimate ⟨휓0 | 푈 |휓0⟩ for any unitary operator 푈 .
4.3 Quantum Speedup The speedup offered by the quantum mean estimation algorithm over classical methods willbe discussed here, in the context of estimating the mean of cos(휑) alone. The discussion can be 퐸 푒푖휑 extended in a straightforward way to the estimation of 휓0 . 4.3.1 Classical Approaches to Estimating the Mean. For an arbitrary function 휑 and a known sampling distribution 푝0 (푥) for the inputs 푥, one classical approach to finding the mean of cos 휑 (푥) is to sequentially query the value of 휑 (푥) for all the inputs, and use the query results to compute the mean. Let the permutation (푥0, 푥1, . . . , 푥푁 −1) of the inputs (0, 1, . . . , 푁 − 1) be the order in which the inputs are queried. The range of allowed values of cos(휃), based only on results for the first 푞 inputs, is given by "푞−1 푁 −1 # "푞−1 푁 −1 # ∑︁ ∑︁ ∑︁ ∑︁ 푝0 (푥) cos 휑 (푥 푗 ) − 푝0 (푥) ≤ cos(휃) ≤ 푝0 (푥) cos 휑 (푥 푗 ) + 푝0 (푥) . (111) 푗=0 푗=푞 푗=0 푗=푞 These bounds are derived by setting the values of cos(휑) for all the unqueried inputs to their highest and lowest possible values, namely +1 and −1. The range of allowed values of cos(휃) shrinks as more and more inputs are queried. In particular, if 푝0 (푥) is equal for all the inputs 푥, the width of the allowed range (based on 푞 queries) is given by 2(푁 − 푞)/푁 . This strategy will take O(푁 ) queries before the width of the allowed range reduces to even, say, 1. Thus, this strategy will not be feasible for large values of 푁 . A better classical approach is to probabilistically estimate the expected value as follows:
(1) Independently sample 푞 random inputs (푥1, . . . 푥푞) as per the distribution 푝0. (2) Return the sample mean of cos(휑) over the random inputs as an estimate for cos(휃). √ Under this approach, the standard deviation of the estimate scales as ∼ 휎0/ 푞, where 휎0 is the standard deviation of cos(휑) under the distribution 푝0. 20 Prasanth Shyamsundar
4.3.2 Precision Vs Number of Queries for the Quantum Algorithm. Note that one call to the operator † Qiter corresponds to O(1) calls to 퐴0 and the oracles 푈휑 and 푈휑 . Let 푞 be the number of times the (controlled) Qiter operation is performed during the QPE subroutine. As 푞 increases, the uncertainty on the estimate for the phase-angle 휃 (up to a two-fold ambiguity) falls at the rate of O(1/푞) [7]. cos(휃) O(1/푞) quadratic Consequently, the uncertainty on also falls at the rate of . This represents a √ speedup over the classical, probabilistic approach, under which the error falls as O(1/ 푞). Note that the variance of the estimate for cos(휃) is independent of a) the size of input space 푁 , and b) 휎2 휑 푥 푝 푥 the variance 0 of cos ( ) under the distribution 0 ( ). It only depends on the true value of cos(휃) and the number of queries 푞 performed during the QPE subroutine.
5 DEMONSTRATING THE ALGORITHMS USING A TOY EXAMPLE In this section, the non-boolean amplitude amplification algorithm and the mean estimation algorithm will both be demonstrated using a toy example. Let the input to the oracle 푈휑 , i.e., the second register, contain 8 qubits. This leads to 28 = 256 basis input states, namely |0⟩,..., |255⟩. Let the toy function 휑 (푥) be 푥 휋 휑 (푥) = , for 푥 = 0, 1,..., 255 . (112) 255 4 The largest phase-shift applied by the corresponding oracle 푈휑 on any basis state is 휋/4, for the state |255⟩. Since, cos 휑 (푥) is monotonically decreasing in 푥, the goal of the amplitude amplification algorithm is to amplify the probabilities of higher values of 푥. Let the initial state, from which the amplification is performed, be the uniform superposition state |푠⟩. 255 1 ∑︁ |휓0⟩ = |푠⟩ = √ |푥⟩ . (113) 256 푥=0 Such simple forms for the oracle function and the initial state allow for a good demonstration of the algorithms. For this toy example, from (30), cos(휃) and 휃 are given by 255 1 ∑︁ 푥 휋 cos(휃) = cos ≈ 0.9001 , (114) 256 255 4 푥=0 휃 ≈ 0.4507 . (115)
Figure 8 shows the value of 휆퐾 , from (69), for the first few values of 퐾. The heuristic choice for the total number of iterations 퐾˜ = ⌊휋/(2휃)⌋ is 3 for this example, as can also be seen from Figure 8.
5.1 Amplitude Amplification For this toy example, the quantum circuit for the non-boolean amplitude amplification algorithm was implemented in Qiskit [22] for three different values of the total number of iterations 퐾, namely 퐾 = 1, 2, and 3. In each case, the resulting circuit was simulated (and measured) 106 times using Qiskit’s QASM simulator. The estimated measurement frequencies for the observations 푥 = 0, 1,..., 255 are shown in Figure 9 as solid, unfilled, histograms—the colors green, red, and blue correspond to 퐾 = 1, 2, and 3, respectively. The expected measurement frequencies, namely 푝퐾 (푥) from (68), are also shown in Figure 9 as dashed curves, and are in good agreement with the corresponding histograms. As can be seen from Figure 9, in each case, the algorithm preferentially amplifies lower values of cos 휑 (푥) or, equivalently, higher values of 푥. This is expected from the fact that 휆퐾 > 0 for all three values of 퐾. Furthermore, as 퐾 increases from 0 to 퐾˜ = 3, the preferential amplification grows Non-Boolean Quantum Amplitude Amplification and Quantum Mean Estimation 21
14
12 6.97 cos( ) + 1 10.01 10 sin2( ) 8
K 6 cos( ) 2 4.74 4 sin ( )
2
0 cos( ) 1 0.53 sin2( ) 0 2 4 6 8 10 12 14 K
Fig. 8. Plot showing 휆퐾 for 퐾 = 0, 1,..., 14, for the toy example considered in Section 5. The red dots correspond to the different integer values of 퐾. The black solid curve depicts the sinusoidal dependence of 휆퐾 2 2 on 퐾. The dotted lines indicate that 휆퐾 oscillates around cos(휃)/sin (휃) with an amplitude of 1/sin (휃) and a period of 휋/휃 (in 퐾 values).
0.012 Observed for K = 1 Prediction for K = 1 Observed for K = 2 Prediction for K = 2 0.010 Observed for K = 3 Prediction for K = 3
0.008
0.006 Frequency 0.004 8 p0(x) = 1/2 K=1 ) ( 0.002 1 K=2 = x
K=3 0.000 0 32 64 96 128 160 192 224 256 Measurement outcome x
Fig. 9. The solid histograms show the observed measurement frequencies of the different values of 푥 ∈ {0, 1 ..., 255} after performing the non-boolean amplitude amplification algorithm. The green, red, andblue solid histograms correspond to the total number of iterations 퐾 being 1, 2, and 3, respectively. In each case, the observed frequencies are based on simulating the circuit for the algorithm 106 times, i.e., 106 shots. The dashed curves, almost coincident with their corresponding solid histograms, show the predictions 푝퐾 (푥) (for the measurement frequencies) computed using (68). While 푝퐾 (푥) is technically defined only for the integer values of 푥, here the dashed curves are interpolated for non-integer values of 푥 using (68). 22 Prasanth Shyamsundar
16 4 phase measurement qubits
= 1 14 10 4 phase measurement qubits
8 phase measurement qubits 2 8 phase measurement qubits = 12
0 10 10
1 8 10
6 10 2 4 Frequency / bin-width Frequency / bin-width 10 3 = 2 2 =
0 0 /4 /2 3 /4 5 /4 3 /2 7 /4 2 0 /4 /2 3 /4 5 /4 3 /2 7 /4 2 Phase estimate Phase estimate
Fig. 10. Histograms showing the observed frequency/bin-width for the different phase estimation outcomes 휔^, for the toy example considered in Section 5. The left and right panels show the frequency/bin-width푦 ( -axis) on linear and logarithmic scales, respectively. In both panels, the green-dashed and red-solid histograms correspond to using 4 and 8 qubits to measure the phase, respectively. The purple-dotted vertical lines on both panels correspond to 휔^ = 휃 and 휔^ = 2휋 − 휃. In each histogram, the last bin (ending at 2휋) is simply a continuation of the first bin (starting at 0), and corresponds to 휔^ = 0. stronger. Note that the probabilities of the 푥-s for which cos 휑 (푥) ≈ cos(휃) are left approximately unchanged by the algorithm, as indicated by the purple-dotted crosshair in Figure 9.
5.2 Mean Estimation Only the estimation of cos(휃), i.e., the real part of 퐸 푒푖휑 is demonstrated here. The imaginary part can also be estimated using the same technique, as described in Section 4.2. Let 푀 be the number of qubits used in the QPE subroutine of the mean estimation algorithm, to contain the phase information. This corresponds to performing the (controlled) Qiter operation 2푀 −1 times during the QPE subroutine. Note that the estimated phase 휔^ can only take the following discrete values [7]: 2휋 푗 휔^ ∈ 푗 ∈ 0,..., 2푀 − 1 . (116) 2푀 In this way, the value of 푀 controls the precision of the estimated phase and, by extension, the precision of the estimate for cos(휃)—the higher the value of 푀, the higher the precision. Two different quantum circuits were implemented, again using Qiskit, for the mean estimation algorithm; one with 푀 = 4 and the other with 푀 = 8. Each circuit was simulated (and measured) using Qiskit’s QASM simulator 106 times, to get a sample of 휔^ values, all in the range [0, 2휋). The observed frequencies (scaled by 1/bin-width) of the different values of 휔^ are shown as histograms on a linear scale in the left panel of Figure 10, and on a logarithmic scale in the right panel. Here the bin-width of the histograms is given by 2휋/2푀 , which is the difference between neighboring allowed values of 휔^. The green-dashed and red-solid histograms in Figure 10 correspond to the circuits with 4 and 8 phase measurement qubits, respectively. The exact values of 휃 and 2휋 − 휃 for this toy example are indicated with vertical purple-dotted lines. In both cases (푀 = 4 and 푀 = 8), the observed frequencies peak near the exact values of 휃 and 2휋 − 휃, demonstrating that 휔^ is a good estimate for them, up to a two-fold ambiguity. Furthermore, as expected, using more qubits for estimating the phase leads to a more precise estimate. Figure 11 shows the observed frequencies (scaled by 1/bin-width) of the different values of cos(휔^), which is the estimate for the mean cos(휃). As with Figure 10, a) the green-dashed and Non-Boolean Quantum Amplitude Amplification and Quantum Mean Estimation 23
70 4 phase measurement qubits ) 102 ( 4 phase measurement qubits s
60 8 phase measurement qubits o c 8 phase measurement qubits
= 1
) 10 50 ( s o c
40 100
30 10 1 ) ( s
20 o 2 c
Frequency / bin-width 10 = Frequency / bin-width 10 ) ( s
3 o c
10 0 1.0 0.5 0.0 0.5 1.0 1.0 0.5 0.0 0.5 1.0 Mean estimate cos( ) Mean estimate cos( )
Fig. 11. Histograms showing the observed frequency/bin-width for the different values of cos(휔^), for the toy example considered in Section 5. The left and right panels show the frequency/bin-width푦 ( -axis) on linear and logarithmic scales, respectively. In both panels, the green-dashed and red-solid histograms correspond to using 4 and 8 qubits respectively. The purple-dotted vertical lines correspond to cos(휔^) = cos(휃 ′). The bins of the cos(휔^) histograms are induced by the equal-width bins of the corresponding 휔^ histograms in Figure 10.
red-solid histograms correspond to 4 and 8 phase measurement qubits, respectively, and b) the left and right panels show the histograms on linear and logarithmic scales, respectively. In each panel, the exact value of cos(휃) is also indicated as a vertical purple-dotted line. As can be seen from Figure 11, the observed frequencies peak11 near the exact value of cos(휃), indicating that cos(휔^) is a good estimate for the same.
6 ANCILLA-FREE VERSIONS OF THE ALGORITHMS Both algorithms introduced this in this paper so far, namely • the amplitude algorithm of Section 2 and its alternative formulation in Section 3.10, and • the mean estimation algorithm of Section 4 use an ancilla qubit to make the quantity 횿0 U휑 횿0 real-valued. This is important for achieving the respective goals of the algorithms. However, the same algorithms can be performed without the ancilla, albeit to achieve different goals, which may be relevant in some use cases. In this section, the ancilla-free versions of the algorithms will be briefly described and analyzed.
6.1 Ancilla-Free Non-Boolean Amplitude Amplification The ancilla-free version of the amplitude amplification algorithm is almost identical to the algorithm introduced in Section 2. The only difference is that in the ancilla-free version, the single-register op- 푆 푈 푈 † † erators 휓0 , 휑 , and 휑 are used in place of the two-register operators S횿0 , U휑 , and U휑 , respectively. For concreteness, the algorithm proceeds as follows:
(1) Initialize a system in the state |휓0⟩. 푆 푈 푆 푈 † (2) Act the operation 휓0 휑 during the odd iterations and 휓0 휑 during the even iterations.
11The upward trends near the left (−1) and right (+1) edges of the plots in Figure 11 are artifacts caused by the Jacobian determinant for the map from 휔^ to cos(휔^). 24 Prasanth Shyamsundar
Analogous to the two-register states |휶 ⟩ and |휷⟩ in (31) and (32), let the single-register states |훼 ′⟩ and |훽 ′⟩ be defined as
푁 −1 ′ ∑︁ 푖휑 (푥) |훼 ⟩ ≡ 푈휑 |휓0⟩ = 푒 푎0 (푥) |푥⟩ , (117) 푥=0 푁 −1 훽 ′ 푈 † 휓 ∑︁ 푒−푖휑 (푥) 푎 푥 푥 . | ⟩ ≡ 휑 | 0⟩ = 0 ( ) | ⟩ (118) 푥=0 Analogous to 휃 defined in (30), let 휃 ′ ∈ [0, 휋/2] and 훿 ∈ [0, 2휋) be implicitly defined by
푁 −1 ′ 푖훿 ′ ∑︁ 2 푖휑 (푥) cos(휃 ) 푒 ≡ ⟨휓0 | 훼 ⟩ = 푎0 (푥) 푒 . (119) 푥=0 ′ cos(휃 ) and 훿 are the magnitude and phase, respectively, of the initial (i.e., 푥 sampled from |휓0⟩) expected value of 푒푖휑 . An important difference between 휃 ′ and 휃 is that cos(휃 ′) is restricted to be non-negative, unlike cos(휃), which can be positive, negative, or zero. Note that cos(휃 ′) can be written as
푁 −1 ′ ∑︁ 2 푖휑′ (푥) cos(휃 ) = 푎0 (푥) 푒 , (120) 푥=0 where 휑 ′(푥) is given by 휑 ′(푥) ≡ 휑 (푥) − 훿 . (121)
Acting the oracle 푈휑 for the function 휑 can be thought of as acting the oracle 푈휑′ for the function 휑 ′, followed performing a global, state independent phase-shift of 훿. Furthermore, from (120), it can seen that 휓0 푈휑′ 휓0 is real-valued. This observation can be used to re-purpose the analysis in Section 3 for the ancilla-free version; the corresponding results are presented here without explicit proofs. 휓 ′ 푘 ≥ Let 푘 be the state of the system of the after 0 iterations of the ancilla-free algorithm. 휓 ′ Analogous to (56), 푘 can be written as 푒푖훿 h ′ ′ −푖훿 ′ i sin (푘 + 1)휃 |휓0⟩ − sin(푘휃 )푒 |훼 ⟩ , if 푘 is odd , sin(휃 ′) 휓 ′ 푘 = (122) 1 h i sin (푘 + 1)휃 ′ |휓 ⟩ − sin(푘휃 ′)푒푖훿 |훽 ′⟩ , if 푘 is even . (휃 ′) 0 sin 푝 ′ 푥 푥 퐾 Let 퐾 ( ) be probability of measuring the system in state after iterations. Analogous to (68), 푝 ′ 푥 퐾 ( ) can be written as n h io 푝 ′ 푥 푝 푥 휆′ 휑 푥 훿 휃 ′ , 퐾 ( ) = 0 ( ) 1 − 퐾 cos ( ) − − cos( ) (123) 휆′ 휆 where the 퐾 , the ancilla-free analogue of 퐾 , is given by 2 sin(퐾휃 ′) sin (퐾 + 1)휃 ′ cos(휃 ′) − cos (2퐾 + 1)휃 ′ 휆′ = = . (124) 퐾 sin2 (휃 ′) sin2 (휃 ′) 푝 ′ 푝 휑 훿 In this case, the probability amplification factor 퐾 / 0 is linear in cos( − ). Non-Boolean Quantum Amplitude Amplification and Quantum Mean Estimation 25
6.2 Ancilla-Free Mean Estimation The ancilla-free mean estimation algorithm described in this subsection can estimate the magni- tude of ⟨휓0 | 푈 |휓0⟩ for a given unitary operator 푈 . Here the algorithm is presented in terms of ′ the oracle 푈휑 , and the goal of the algorithm is to estimate cos(휃 ) from (119), i.e., the magnitude of 퐸 푒푖휑 휓 푈 휓 휓0 ≡ 0 휑 0 . Let the unitary operator 푄evenodd be defined as 푄 푆 푈 푆 푈 † . evenodd ≡ 휓0 휑 휓0 휑 (125) Its action corresponds to performing the (ancilla-free) even-iteration operation once, followed by the odd-iteration operation. Analogous to (105) and (106), the state |휓0⟩ can be written as ′ ′ 휂+ − 휂− |휓0⟩ = √ , (126) 2 ′ ′ where 휂+ and 휂− are given by 푒±푖휃′ 휓 푒−푖훿 훼 ′ ′ | 0⟩ − | ⟩ 휂± = √ . (127) 푖 2 sin(휃 ′) ′ ′ 2푖휃′ −2푖휃′ 휂+ and 휂− are unit-normalized eigenstates of 푄evenodd with eigenvalues 푒 and 푒 , respec- tively. ′ ±2푖휃′ ′ 푄evenodd 휂± = 푒 휂± , (128) ′ ′ 휂± 휂± = 1 . (129) ′ ′ These properties of 휂+ and 휂− in (128) and (129) are proved in Appendix D. The observations in (126) and (128) lead to the following algorithm for estimating cos(휃 ′): (1) Perform the QPE algorithm with • 푄evenodd serving the role of the unitary operator under consideration, and • the superposition state |휓0⟩ in place of the eigenstate required by the QPE algorithm as input. Let the output of this step, appropriately scaled to be an estimate of the phase angle in the range [0, 2휋), be 휔^. ′ (2) Return cos 휔^/2 as the estimate for cos(휃 ). Proof of correctness of the algorithm: In this version of the algorithm, 휔^ will be an estimate for either 2휃 or 2휋 − 2휃.12 So, 휔^/2 will be an estimate for either 휃 ′ or 휋 − 휃 ′. Since, a) cos(휋 − 휃 ′) = ′ ′ − cos(휃 ), and b) cos(휃 ) is a non-negative number, it follows that cos 휔^/2 is an estimate for cos(휃 ′).
7 SUMMARY AND OUTLOOK In this paper, two new oracular quantum algorithms were introduced and analyzed. The action of the oracle 푈휑 on a basis state |푥⟩ is to apply a state dependent, real-valued phase shift 휑 (푥). The first algorithm is the non-boolean amplitude amplification algorithm, which, starting from an initial superposition state |휓0⟩, preferentially amplifies the amplitudes of the basis states based on the value of cos(휑). In this paper, the goal of the algorithm was chosen to be to preferentially amplify the states with lower values of cos 휑 (푥). The algorithm is iterative in nature. After 퐾 iterations, the probability for a measurement of the system to yield 푥, namely 푝퐾 (푥), differs from
12 ′ ′ ′ If 휃 = 0, the phase angle being estimated is 0 for both 휂+ and 휂− . 26 Prasanth Shyamsundar