1 Introduction, motivation and main results

Quantum Amplitude Estimation (QAE) is an algorithm which retrieves information stored in the amplitude of a quantum state. It is argued to have a quadratic speedup over simple repeated sampling of the quantum state. For this reason, QAE is a central subroutine in quantum computation for various applications, e.g. in chemistry [1, 2], finance [35], and machine learning [6, 7]. The original QAE algorithm [8] is built composing Quantum Phase Estimation (QPE) [9] and Grover’s algorithms [10]. Standard QPE relies on a Quantum Fourier Transform (QFT) which is very demanding in terms of computational resources, especially if considered for the Noise Intermediate-Scale Quantum era (NISQ).

Several approaches have been proposed to reduce the resources needed by QAE, both in terms of qubits and circuit depth, while approximately preserving the same speedup. These approaches can be broadly categorized in three families.

  1. 1.

    The first family consists in techniques which take advantage of classical post-processing. As an example, in [11] the authors show how to replace QPE by a set of Grover iterations combined with a Maximum Likelihood Estimation (MLE) post-processing algorithm. To correctly assess the overall performance of such techniques, one needs to include the overhead due to the classical post-processing in the total cost of the algorithm, therefore diminishing the potential speedup. Moreover, at the time of writing, no rigorous proof of the correctness of the proposed algorithms has been given yet.

  2. 2.

    The second family includes strategies which still rely on phase estimation, but eliminate the need of a QFT. The main idea is to replace the QFT with Hadamard tests [12]. This variation of QPE was first suggested by Kitaev [13] and is called “iterative phase estimation”. In papers following this approach such as [12] it is not even clear how to control the accuracy of the algorithm other than possibly increasing the number of measurements. Besides, they do not give rigorous proof of the correctness of the algorithm.

  3. 3.

    The methods belonging to the third and last family are based entirely on Grover iterations and they do not require any post-processing. The main difference among algorithms of this family is in the amplification policy. Representative examples of this approach are the Iterative Quantum Amplitude Estimation (IQAE) and the Quantum Amplitude Estimation Simplified (QAES) algorithms [14, 15]. Both provide rigorous proofs of the correctness of the techniques. Although the strategy described in [15] achieves the desired asymptotic complexity exactly (i.e. without logarithmic factors), the constants involved are very large, and likely to render the algorithm impractical. In [14] they do not exactly match the desired asymptotic complexity, yet the constants involved are much lower.

RQAE can be thought of as a generalization of the Quantum Coin algorithm [16, 17] and it is based on an iterative strategy, like [14, 15]. In particular, RQAE utilizes a set of auxiliary amplitudes which allow to shift in a controlled fashion the amplitude to be retrieved. Such shift can be easily and efficiently implemented following the methods presented in [18]. Relying on this, we propose a specific strategy to iteratively choose the amplification factor k (i.e. the Grover exponent) and the shift b at each iteration, progressively improving the estimation of the quantum amplitude to be retrieved, i.e. the target amplitude.

We prove a set of tight bounds for the RQAE algorithm. Moreover, the bounds for RQAE depend on a free parameter q which directly controls the amplification policy. More specifically, the parameter q is a minimum bound for the ratio between the amplification on consecutive steps:

$$ q\leq q_{i} \equiv \frac {K_{i+1}}{K_{i}} \equiv \frac {2k_{i+1}+1}{2k_{i}+1} . $$
(1)

The parameter q affects both the depth of the circuit and the performance (in terms of calls to the oracle) of the algorithm, thus offering a handle to discuss the trade-off between the two.

The other feature that makes RQAE different from alternative amplitude estimation algorithms is the possibility of recovering the sign of the amplitude to be retrieved, hence the name Real Quantum Amplitude Estimation (RQAE). Concretely, RQAE is a parametric algorithm that depends on a real input amplitude \(b_{1}\), which provides a reference, through which we can unambiguously assign a phase to every other amplitude in the quantum register. Then, when referring to the sign of an amplitude, we mean the relative phase between such amplitude and \(b_{1}\). As the notation already suggests, \(b_{1}\) is the shift mentioned above for the first iteration. The new sensitivity to the relative sign of an amplitude allows one to tackle a wider variety of problems, precluded to standard algorithms.

The remainder of this paper is organized as follows. Section 2 introduces the intuition behind the construction of the algorithm. In Sect. 3 we state some theoretical results on the performance of the algorithm for a specific set of parameters (for the rigorous proof see Appendix A). Moreover, we confirm the theoretical properties with a set of simulated experiments. To conclude, we discuss the results and related open questions in Sect. 4.

2 Real quantum amplitude estimation

Consider a one-parameter family of oracles \(\mathcal{A}_{b}\) that, acting on the state \(\mathopen{\lvert }0\mathclose{\rangle }\), yield

$$ \mathcal{A}_{b}\mathopen{\lvert }0\mathclose{ \rangle } = \mathopen{\lvert }\psi \mathclose{\rangle } = (a+b )\mathopen{\lvert } \phi \mathclose{\rangle }+c_{b} \, \mathopen{\lvert }\phi ^{\perp}\mathclose{\rangle }_{b} , $$
(2)

where a is a real number, b is an auxiliary, continuous and real parameter that we call “shift”, and \(\mathopen{\lvert }\phi \mathclose{\rangle }\) is a specified direction in the Hilbert space \({\mathcal{H}}\). The RQAE algorithm estimates the amplitude a exploiting the possibility of tuning the shift b iteratively. The ket \(\mathopen{\lvert }\psi \mathclose{\rangle }\) belongs to the plane \(\Pi _{b} = \text{span}\{\mathopen{\lvert }\phi \mathclose{\rangle },\mathopen{\lvert }\phi ^{\perp}\mathclose{\rangle }_{b}\} \subset { \mathcal{H}}\) for which the kets \(\mathopen{\lvert }\phi \mathclose{\rangle }\) and \(\mathopen{\lvert }\phi ^{\perp}\mathclose{\rangle }_{b}\) provide an orthonormal basis. Note that all the quantities with a sub-index b depend on the actual value of the shift. In practice, the construction of oracles such as \(\mathcal{A}_{b}\) from a given un-shifted oracle \(\mathcal{A}\) is generally not difficult. In most cases, a controlled shift of an amplitude can be efficiently implemented via Hadamard gates and some controlled operations. We give an example on how to build such a shifted oracle in Appendix B. In particular, its implementation is straightforward in the framework described in [18].

Given a precision level ϵ and a confidence level \(1-\gamma \), the goal of the algorithm is to compute an interval \((a_{I}^{\min},a_{I}^{\max}) \subset [-1,1]\) of width smaller than 2ϵ which contains the value of a with probability greater or equal to \(1-\gamma \) (see Fig. 1). Here, I denotes the number of iterations to achieve the prescribed accuracy. We take as a representative of the interval its center, \(a_{I} = \frac{a_{I}^{\min}+a_{I}^{\max}}{2}\), thus admitting a maximum error of ϵ:

$$ \mathbb{P} \bigl[ \vert a-a_{I} \vert \geq \epsilon \bigr] \leq \gamma . $$
(3)
Figure 1
figure 1

a is the target amplitude to be estimated, 2ϵ is the width of the estimation interval with bounds \((a_{I}^{\min},a_{I}^{\max})\), \(a_{I}\) is the center of the confidence interval. In the image we distinguish three possibilities to emphasize that the algorithm described below is sensitive to the sign of a

It is convenient to express the amplitudes in terms of their corresponding angles, that is, we consider the generic mapping \(\theta _{x} = \arcsin (x)\) for any real amplitude x. Note that the angle representation is particularly suited to describe Grover amplifications, which indeed admit an interpretation as rotations in the plane \(\Pi _{b}\). As an example, the state \(\mathopen{\lvert }\psi \mathclose{\rangle }\) given in (2) can be written as

$$ \mathopen{\lvert }\psi \mathclose{\rangle } = \sin (\theta _{a+b}) \mathopen{\lvert }\phi \mathclose{\rangle }+\cos (\theta _{a+b}) \bigl\lvert \phi ^{\perp}\bigr\rangle _{b} , $$
(4)

where \(\theta _{a+b}\) represents a rotation in the plane \(\Pi _{b}\) defined above. Throughout the paper, we will be changing back and forth from the representation in terms of the actual amplitude or its associated angle whenever needed. To avoid notational clutter, we henceforth drop the sub-index b on the perpendicular ket, leaving its dependence on the shift as understood. Actually, such dependence does not play any role for the algorithm.

In the following subsections we address the details of the procedure describing all the steps contained in each iteration.

2.1 First iteration: estimating the sign

This step achieves a first estimation of the bounds of the confidence interval \((a_{1}^{\min},a_{1}^{\max})\). Normally, this estimation would not be sensitive to the sign of the underlying amplitude because, when sampling from a quantum state, we obtain the square of the amplitude. Nevertheless, taking advantage of the shift b we can circumvent this limitation. In order to compute the sign, we will combine two different pieces of information: the result of measuring the two oppositely shifted states \(\mathopen{\lvert }\psi _{1}\mathclose{\rangle }_{\pm}\) defined as:

$$ \begin{aligned} \mathopen{\lvert }\psi _{1}\mathclose{\rangle }_{+} &:= (a+b_{1} )\mathopen{\lvert }\phi \mathclose{\rangle } + \cdots , \\ \mathopen{\lvert }\psi _{1}\mathclose{\rangle }_{-} &:= (a-b_{1} ) \mathopen{\lvert }\phi \mathclose{\rangle } + \cdots , \end{aligned} $$
(5)

for an arbitrary real shift \(b_{1}\). The sign of \(b_{1}\) has to be decided at the start of the algorithm to have a clear reference. In practice, in some setups it is possible to measure at the same time both states taking advantages of Hadamard gates as in the quantum arithmetic techniques discussed in [18] (more details are given in Appendix B). As a and \(b_{1}\) are real numbers, we have the identity:

$$ a = \frac { (a+b_{1} )^{2}- (a-b_{1} )^{2}}{4b_{1}} , $$
(6)

and we can build a first empirical estimation \(\hat{a}_{1}\) of a as follows:

$$ \hat{a}_{1} = \frac {\hat{p}_{\text{sum}}-\hat{p}_{\text{diff}}}{4b_{1}} , $$
(7)

where \(\hat{p}_{\text{sum}}\) and \(\hat{p}_{\text{diff}}\) are the empirical probabilities of getting \(\mathopen{\lvert }\phi \mathclose{\rangle }\) when measuring \(\mathopen{\lvert }\psi _{1}\mathclose{\rangle }_{-}\) and \(\mathopen{\lvert }\psi _{1}\mathclose{\rangle }_{+}\), respectively. Throughout the paper, when we measure, we will use to denote the empirical probability obtained from direct sampling. As an example, if in iteration i we sample the state \(N_{i}\) times, getting \(\mathopen{\lvert }\phi \mathclose{\rangle }\) as an outcome \(\hat{N}_{i}\) times, the estimated probability of \(\mathopen{\lvert }\phi \mathclose{\rangle }\) will be \(\hat{p}_{i} = \frac {\hat{N}_{i}}{N_{i}}\).

From (6) and (7), we can obtain a first confidence interval:

$$ \begin{aligned} &a^{\max}_{1} = \min \biggl( \frac {\hat{p}_{\text{sum}}-\hat{p}_{\text{diff}}}{4b_{1}}+ \frac {\epsilon ^{p}_{1}}{ \vert 2b_{1} \vert },1 \biggr), \\ &a^{\min}_{1} = \max \biggl( \frac {\hat{p}_{\text{sum}}-\hat{p}_{\text{diff}}}{4b_{1}}- \frac {\epsilon ^{p}_{1}}{ \vert 2b_{1} \vert },-1 \biggr), \\ &a_{1} = \frac {a^{\max}_{1}+a^{\min}_{1}}{2} , \\ &\epsilon _{1}^{a} = \frac {a^{\max}_{1}-a^{\min}_{1}}{2} , \end{aligned} $$
(8)

where the max and the min operations are introduced because we know a priori that probabilities are bounded between 0 and 1. The assignment of an error \(\epsilon ^{p}_{1}\) to the empirical result \(\hat{p}_{1}\) relies on a statistical analysis and depends on the employed statistical bound, such as Chebysev, Chernoff (Hoeffding) and Clopper-Pearson bounds. Here one of the main differences with respect to the other algorithms present in the literature becomes obvious, although the probabilities are bounded between 0 and 1 the estimated amplitude obtained by the identity (7) is now bounded between \(-1\leq a_{1}\leq 1\), that is, it can be negative (see Fig. 2). Note that the sign of the amplitude depends on the sign of \(b_{1}\), which is taken as being positive for simplicity. However, this election is arbitrary and it could be chosen negative.

Figure 2
figure 2

Left: the dot corresponds to a, namely the probability to be estimated; \(a_{1}^{\min}\) and \(a_{1}^{\max}\) define the confidence interval whose width is \(2\epsilon _{1}\). Right: the same confidence interval represented in terms of angles. Note that the “true value” (represented by either a and \(\theta _{a}\)) falls in a generic position within the confidence interval. To avoid clutter, here we are not representing the central value of the confidence interval

2.2 Following iterations: amplifying the probability and shrinking the interval

On consecutive iterations, given an input confidence interval \((a^{\min}_{i},a^{\max}_{i})\) (see Fig. 3a) we want to obtain a tighter one \((a^{\max}_{i+1},a^{\min}_{i+1})\) and iterate the process until the desired precision ϵ is reached. At each iteration, the process for narrowing the interval starts by choosing a new shift according to

$$ b_{i+1} = -a^{\min}_{i} . $$
(9)

This election is not unique. Again, we could have chosen \(b_{i+1} = -a^{\max}_{i}\). Always keep in mind that the phase that we are obtaining is relative to the original value of \(b = b_{1}\). Considering the choice (9), we force our lower bound to match exactly zero (see Fig. 3b). The boundaries of the confidence interval \((a^{\min}_{i},a^{\max}_{i})\), when shifted and then expressed in terms of the corresponding angles, become:

$$ \begin{aligned} &\alpha ^{\max}_{i} = \arcsin \bigl(a^{\max}_{i}-a^{\min}_{i} \bigr) = \arcsin \bigl(2\epsilon ^{a}_{i} \bigr), \\ &\alpha ^{\min}_{i} = 0. \end{aligned} $$
(10)

The angular region \(\alpha _{i}^{\min} \leq \alpha _{i} \leq \alpha _{i}^{\max}\) represents the confidence interval and we refer to it as confidence fan.

Figure 3
figure 3

Graphical representation of the steps performed in the \(i+1\) iteration. The solid grey line represents the unknown target value (which is not necessarily the center of the confidence interval). The dashed lines represent the bounds obtained at the i-th step, while the dotted lines represent the bounds obtained at step \(i+1\)

The next step takes advantage of the Grover operator, defined as

$$ \mathcal{G} = -\mathcal{A}_{b} \mathcal{R}_{\mathopen{\lvert }0\mathclose{\rangle }}\mathcal{A}_{b}^{ \dagger} \mathcal{R}_{\mathopen{\lvert }\phi \mathclose{\rangle }} , $$
(11)

where

R | 0 = 1 2 | 0 0 | , R | ϕ = 1 2 | ϕ ϕ | ,
(12)

and \(\mathcal{A}_{b}\) is the oracle defined in (2). The Grover operator applied \(k_{i+1}\) times transforms the generic angle θ into \((2k_{i+1}+1)\theta \), see Fig. 3c. Hence, the state \(\mathopen{\lvert }\psi _{i+1}\mathclose{\rangle }_{+}\) is transformed to:

$$\begin{aligned} &\mathopen{\lvert }\psi _{i+1}\mathclose{\rangle }_{+} = (a+b_{i+1} )\mathopen{\lvert }\phi \mathclose{ \rangle }+c_{i} \mathopen{\lvert }\phi ^{\perp}\mathclose{ \rangle }= \bigl(a-a_{i}^{\min} \bigr)\mathopen{\lvert }\phi \mathclose{\rangle }+c_{i} \mathopen{\lvert }\phi ^{\perp} \mathclose{\rangle } \equiv \sin (\theta _{i+1})\mathopen{\lvert }\phi \mathclose{\rangle }+\cos ( \theta _{i+1})\mathopen{\lvert }\phi ^{\perp}\mathclose{\rangle } \\ &\quad \xrightarrow{{\mathcal{G}}^{k_{i+1}}}\quad \sin \bigl((2k_{i+1}+1) \theta _{i+1} \bigr)\mathopen{\lvert } \phi \mathclose{\rangle }+\cos \bigl((2k_{i+1}+1)\theta _{i+1} \bigr)\mathopen{\lvert }\phi ^{\perp}\mathclose{\rangle } , \end{aligned}$$
(13)

where the sub-index “+” is employed as in (5), \({\mathcal{G}}^{k_{i+1}}\) indicates the Grover operator applied \(k_{i+1}\) times and, in the second equality, we use (9). Moreover, in (13) we have implicitly defined the angle \(\theta _{i+1} \equiv \arcsin (a-a_{i}^{\text{min}} )\) for which we will use the synonym notation \(\theta _{a-a_{i}^{\text{min}}}=\theta _{i+1}\), according to convenience of presentation.

In order to avoid ambiguities due to the lack of a bijective correspondence angle/amplitude, when measuring amplified probabilities, we cannot allow the amplified angles to go beyond \([0,\frac {\pi}{2} ]\). Namely, we need the amplified confidence fan to stay within the first quadrant. Relying on (10), we choose the Grover amplification exponent as:

$$ k_{i+1} = \biggl\lfloor \frac {\pi}{4\arcsin (2\epsilon ^{a}_{i} )}- \frac {1}{2} \biggr\rfloor , $$
(14)

so that we maximize the amplification factor while respecting the angle constraint.

Now, we measure the state \(\mathopen{\lvert }\psi _{i+1}\mathclose{\rangle }\) in the amplified space, obtaining the empirical probability

$$ \hat{p}_{i+1}\approx \sin ^{2} \bigl((2k_{i+1}+1) \theta _{i+1} \bigr) , $$
(15)

with the statistical error \(\epsilon ^{p}_{i+1}\), and define:

$$\begin{aligned} & p^{\max}_{i+1} := \min \bigl( \hat{p}_{i+1}+\epsilon ^{p}_{i+1},1 \bigr) , \\ & p^{\min}_{i+1} := \max \bigl( \hat{p}_{i+1}-\epsilon ^{p}_{i+1},0 \bigr) , \\ & p_{i+1} := \frac {p^{\max}_{i+1}+p^{\min}_{i+1}}{2} , \end{aligned}$$
(16)

where the max and min functions play an analogous role as in Sect. 2.1 (see Fig. 3d).

In the next step we transform the angles corresponding to \(p^{\max}_{i+1}\) and \(p^{\min}_{i+1}\) to the non-amplified space:

$$ \begin{aligned} & \theta ^{\max}_{i+1} = \frac {\arcsin \left( \sqrt{p^{\max}_{i+1}} \right) }{2k_{i+1}+1} , \\ & \theta ^{\min}_{i+1} = \frac {\arcsin ( \sqrt{p^{\min}_{i+1}} ) }{2k_{i+1}+1} . \end{aligned} $$
(17)

In other words, we have just “undone” the amplification (see Fig. 3e).

Finally, we have to undo the shift (9), actually performing an opposite shift (see Fig. 3f). Using definitions analogous to those given in (8), we finally obtain:

$$ \begin{aligned} & a^{\max}_{i+1} = \sin \biggl( \frac {\arcsin \left( \sqrt{p^{\max}_{i+1}} \right) }{2k_{i+1}+1} \biggr)-b_{i+1} , \\ & a^{\min}_{i+1} = \sin \biggl( \frac {\arcsin (\sqrt{p^{\min}_{i+1}} ) }{2k_{i+1}+1} \biggr)-b_{i+1} , \\ & a_{i+1} = \frac {a^{\max}_{i+1}+a^{\min}_{i+1}}{2} , \\ & \epsilon ^{a}_{i+1} = \frac {a^{\max}_{i+1}-a^{\min}_{i+1}}{2} = \frac{1}{2}\sin \biggl( \frac {\arcsin (\sqrt{p^{\max}_{i+1}} )}{2k_{i+1}+1} \biggr)- \frac{1}{2}\sin \biggl( \frac {\arcsin (\sqrt{p^{\min}_{i+1}} )}{2k_{i+1}+1} \biggr). \end{aligned} $$
(18)

Recall that the goal is to reduce the width of the confidence interval until the desired precision ϵ is reached. To this sake, one has to repeat the iteration just described until the goal is met.

Remark 2.1

Throughout this section we have addressed the general structure of the algorithm. Nevertheless, we have not specified the values of all the parameters involved. More specifically, we have not discussed how \(\epsilon ^{p}_{i}\) is obtained. This parameter strictly depends on the number of shots on each iteration, \(N_{i}\), and the confidence required on each iteration, \(1-\gamma _{i}\), through a set of bounds such as Hoeffding’s inequality or Clopper-Pearson bound (see [19, 20]). In Sect. 3, more insight about these choices is provided.

3 RQAE: configuration and properties

As mentioned before, in order to complete the RQAE method, we need to incorporate a particular choice for the parameter \(\epsilon ^{p}_{i}\) and, thus, the parameters involved in its computation, i.e., \(N_{i}\) and \(1-\gamma _{i}\), the number of shots and confidence level of the i-th iteration, respectively. With the aim of being able to theoretically characterize the algorithm, we propose to take, ∀i, the following constant values:

$$ \begin{aligned} N_{i}(q,\epsilon ,\gamma ) &= \biggl\lceil \frac {1}{2\epsilon ^{p}(q)^{2}}\log \biggl( \frac {2T(q,\epsilon )}{\gamma} \biggr) \biggr\rceil , \\ \gamma _{i}(q,\epsilon ,\gamma ) &= \frac {\gamma}{T(q,\epsilon )}, \\ b_{1}(q) &= \frac {1}{2}\sin \biggl(\frac {\pi}{2(q+2)} \biggr), \end{aligned} $$

where

$$ \epsilon ^{p} (q) = \frac {1}{2}\sin ^{2} \biggl(\frac {\pi}{2(q+2)} \biggr) \quad \text{and} \quad T(q,\epsilon ) = \log _{q} \biggl(q^{2} \frac {\arcsin (\sqrt{2\epsilon ^{p}(q)} )}{\arcsin (2\epsilon )} \biggr). $$

Once the free parameters are selected, the RQAE is completed and ready to be used. Of course, other choices can be made. In Algorithm 1, the RQAE algorithm is schematically described. Note that our selection of the parameters is uniquely determined by the input quantities q, ϵ and γ. As we will see in Sect. 3.1, the choice considered here presents several interesting properties.

Algorithm 1
figure a

RQAE pseudocode

3.1 Properties

Given the proposed configuration in Algorithm 1, the RQAE algorithm presents several properties which are listed in the next theorem.

Theorem 3.1

Given ϵ, γ and q, and taking the parameters:

$$\begin{aligned}& N_{i}(q,\epsilon ,\gamma ) = \biggl\lceil \frac {1}{2\epsilon ^{p}(q)^{2}}\log \biggl( \frac {2T(q,\epsilon )}{\gamma} \biggr) \biggr\rceil , \end{aligned}$$
(19)
$$\begin{aligned}& \gamma _{i}(q,\epsilon ,\gamma ) = \frac {\gamma}{T(q,\epsilon )}, \end{aligned}$$
(20)
$$\begin{aligned}& b_{1}(q) = \frac {1}{2}\sin \biggl( \frac {\pi}{2(q+2)} \biggr) , \end{aligned}$$
(21)

with

$$\begin{aligned}& \epsilon ^{p} (q) = \frac {1}{2}\sin ^{2} \biggl(\frac {\pi}{2(q+2)} \biggr) , \end{aligned}$$
(22)
$$\begin{aligned}& T(q,\epsilon ) = \log _{q} \biggl(q^{2} \frac {\arcsin (\sqrt{2\epsilon ^{p}(q)} )}{\arcsin (2\epsilon )} \biggr) , \end{aligned}$$
(23)

then,

  1. 1.

    The error at each iteration is bounded by:

    $$ \epsilon ^{p}_{i}\leq \epsilon ^{p}. $$
    (24)
  2. 2.

    We get the amplification policy:

    $$ q_{i} = \frac {2k_{i+1}+1}{2k_{i}+1}\geq q. $$
    (25)
  3. 3.

    The depth of the circuit is bounded by:

    $$ k_{I}\leq \biggl\lceil \frac {1}{2} \frac {\arcsin (\sqrt{2\epsilon ^{p}} )}{\arcsin (2\epsilon )}- \frac {1}{2} \biggr\rceil =k^{\max}. $$
    (26)
  4. 4.

    The algorithm finishes before \(T(q,\epsilon )\) iterations:

    $$ T>I. $$
    (27)
  5. 5.

    The algorithm obtains a precision ϵ with confidence \(1-\gamma \) (Proof of Correctness):

    $$ \mathbb{P} \bigl[a\notin \bigl(a^{\min}_{I},a^{\max}_{I} \bigr) \bigr]\leq \gamma . $$
    (28)
  6. 6.

    The total number of calls to the oracle is bounded by:

    $$\begin{aligned} N_{\textit{oracle}}< {}& \frac {1}{\sin ^{4} \left( \frac {\pi}{2(q+2)} \right) }\log \left[ \frac {2\sqrt{e}\log _{q} \left( \frac {q^{2}\pi}{2(q+2)\arcsin (2\epsilon )} \right) }{\gamma} \right] \\ &{}\cdot \biggl(\frac {\pi}{2(q+2)\arcsin (2\epsilon )}+2 \biggr) \biggl(1+ \frac {q}{q-1} \biggr) . \end{aligned}$$
    (29)

The proof of Theorem 3.1 can be found in Appendix A.

The first important feature is the fourth property, where we see that the algorithm achieves the desired precision ϵ with confidence at least \(1-\gamma \), which was our goal in the beginning (see Equation (3)). Property number two justifies why we call the parameter q the “amplification policy”. The reason for this is that q is indeed the minimum ratio of the amplification of an iteration with respect to the previous, thus controlling the amplification policy. The depth of the circuit is intimately related with the amplification policy. In property number three we have a clear bound \(k^{\max}\) for the depth. To get a clearer idea of this bound, in Fig. 4 we depict the maximum depth of the circuit \(k^{\max}\) in terms of the precision ϵ for different amplification policies q. As we see, the depth decreases with q, but at the cost of increasing the number of shots at each iteration (see Equation (19)). This directly leads to the question about what is more relevant in relation to the total number of shots: either performing more shots for each iteration with less iterations (and thus less circuit depth) or performing less shots at the cost of increasing the total number of iterations. This question is directly answered with the sixth property, where we have a bound for the number of shots in terms of the required precision ϵ, the confidence \(1-\gamma \) and the amplification policy q. To facilitate the interpretation of the expression, in Fig. 5 we represent the theoretical number of calls to the oracle in terms of the precision ϵ for different amplification policies q and a fixed confidence level of \(1-\gamma = 0.95\). The dash dotted line, the black solid thin line and the gray solid thin lines are there for comparison purposes. We know that, without amplification, the number of executions of the circuit needed to achieve a precision ϵ grows as:

$$ N_{\mathrm{oracle}}\sim \frac {1}{\epsilon ^{2}}, $$

as it is given by classical bounds such as Chebysev or Clopper-Pearson. A quadratic speedup would then be obtaining the same precision with a total number of oracle calls:

$$ N_{\mathrm{oracle}}\sim \frac {1}{\epsilon}. $$

As we see in Fig. 5 the number of calls needed in our method to achieve a precision ϵ grows approximately as \(1/\epsilon \). This means that we have approximately achieved a quadratic speedup compared with unamplified sampling. Furthermore, we see that it is more efficient in terms of the total number of calls to the oracle to use lower amplification policies.

Figure 4
figure 4

Theoretical maximum depth of the circuit \(k^{\max}\) in terms of the precision ϵ

Figure 5
figure 5

Theoretical maximum number of calls to the oracle \(N_{\text{oracle}}\) in terms of the precision ϵ for different values of the amplification policy q and a fixed confidence level \(1-\gamma = 0.95\). Lines \(1/\epsilon \) and \(1/\epsilon ^{2}\) are depicted for comparison purposes

In general, the appropriate amplification policy depends on each specific case. On the one hand, the optimal q depends both on the precision ϵ and the confidence level \(1-\gamma \). On the other hand, in real hardware it could be more interesting to choose higher values of q, as we can not run arbitrarily long circuits.

Last, we have depicted the theoretical bound for the IQAE algorithm which, to our knowledge, represents the state of the art. As we see, the RQAE performance is better than that of the IQAE for some values of q. Note that the comparison with IQAE is not direct since they are estimating the probability and we are estimating the amplitude. However, in Appendix C we show that, under some weak assumptions, this bounds are comparable.

3.2 Empirical performance

The sixth property of Theorem 3.1 gives us an upper bound to the number of calls to the oracle. However, it is always interesting to see how this theoretical bound compares with a real execution of the algorithm. Using the Quantum Learning Machine (QLM) developed by Atos we build a circuit with a total of 5 qubits and we estimate one of the amplitudes encoded in the circuit with our method. Our algorithm is executed with a confidence level of \(1-\gamma = 0.95\) and different amplification policies \(q \in \{2,10,20\}\). For each level of precision ϵ we perform 100 experiments. As we see in Fig. 6 the theoretical bound for the total number of calls to the oracle is respected by the experiments and it is not too loose. Furthermore, also the empirical behavior of \(N_{\text{oracle}}\) with respect to ϵ follows the qualitative trend expected theoretically.

Figure 6
figure 6

Number of calls to the oracle \(N_{\text{oracle}}\) versus the required precision ϵ. The picture is in a log-log scale with the x-axis inverted. The experimental points (circles, squares and diamonds) represent the mean number of oracle calls obtained by the experiments while the error bars stretch from the maximum to the minimum value obtained in the same experiments. The lines are the corresponding theoretical bounds from Equation (29)

In Fig. 7 we see the empirical result and the theoretical bounds for the amplification in the last iteration and the number of rounds performed. To explain the behaviour we will focus in the results for \(q = 20\). The first five points corresponds to \(I = 1\) as we can see in the right picture. That is the same as saying that for the first five points \(k_{I} = 0\). As the y-axis of the left picture is in log scale we cannot see the points. This phenomena occurs when the first estimation \(\epsilon ^{a}_{1}\) is lower than the required ϵ. In this situation the algorithm does not need to perform more than one iteration. Next, we see in the right picture that we jump to one iteration. In the left figure we see two different regimes. In the first one the amplification matches that of the maximum amplification \(k^{\max}\). In the second one we see that it is settled to \(k_{I} = 10\). To give an explanation for it we first compute which is the minimum \(k_{2}\) possible with \(q= 20\):

$$ \frac {2k_{2}+1}{2k_{1}+1} = 2k_{2}+1 = q_{1}\geq 20\quad \implies\quad k_{2} \geq 9.5 . $$
(30)

As \(k_{2}\) can only have natural values we conclude that \(k_{2}\) is at least 10. Now the explanation of the two regimes becomes more clear. As with the first iteration we do not achieve the required precision ϵ we need to do another iteration. In this second iteration, as \(q=20\), we are sure that \(k_{2}\) is at least 10. But this amplification is too much for the required precision, so the condition in Algorithm 1 on the maximum amplification permitted is activated matching the value of the last amplification to that of the maximum amplification needed \(k_{I} = k^{\max}\). This happens until we reach \(k_{2} = 10\). At this point the maximum bound over the number of amplifications of the last round exceeds the number of amplifications governed by q (\(k_{2} \approx 10\)) and the previous condition deactivates. This new number of amplifications is more than enough to attain the precision required, so the algorithm maintains the same level of amplification and the same number of rounds until the point where that number of amplification is not enough to obtain the required precision. In that moment the algorithm performs another iteration and the number of amplifications of the last rounds is again fixed to that of \(k^{\max}\).

Figure 7
figure 7

In the left figure we plot the amplification of the last iteration \(k_{I}\) versus the target precision ϵ. In the right figure we plot the number of rounds I versus the target precision ϵ. The left picture is in a log-log scale with the x-axis inverted. The right picture is in a x-log scale with the x-axis inverted. Each experimental point (circles and diamonds) represent the mean for the last amplification and number of rounds of 100 experiments. The error bars stretch from the maximum to the minimum value obtained in the same 100 experiments. The lines are the corresponding theoretical bounds from Equation (26) and Equation (27). To avoid clutter, we have omitted the results for \(q =10\)

4 Conclusion

Throughout this paper we have proposed a new methodology for estimating an amplitude encoded in a quantum circuit. This methodology depends on the possibility of defining a new class of shifted oracles which are easily built, at least in some cases of practical interest. For a suitable choice of parameters described in Algorithm 1, we have proven a set of interesting properties. They include a proof of correctness, a bound on the maximum depth of the algorithm and an upper bound on the total number of shots, hence characterizing the performance of the algorithm.

If we compare RQAE to similar algorithms in the literature such as QAE, QAES and IQAE we have three advantages and one caveat. The caveat is obviously that we are constrained by the possibility of constructing an appropriate oracle including the shift. The first advantage is that we are extracting more information from the quantum circuit than just the module of the amplitude. This feature can be of extreme importance for certain applications where the result can be positive or negative. The second advantage is that we can control to some extent the depth of the circuit, a crucial feature in the current NISQ era. The third advantage is that the total number of calls to the oracle is lower to that QAES and IQAE with an appropriate choice of the amplification policy. It is true that QAES has a better order of convergence, however the constants involved are very large, making the method unfeasible for most values of ϵ used in practice (see the comparison done in [14]).

The choice of parameters considered in the present paper is not unique and alternative choices could be more efficient in terms, for example, of the total number of shots. In fact, we believe it is interesting to explore different parameter settings in the future. One such possibility consists in considering to change the number of shots on each iteration in a dynamical manner. This is motivated by the fact that, in the early stages, q has to be large in order to ensure that we get amplification while, as we increase the number of amplifications, we can lower the value of q while still getting amplification. In this sense, we could consider our current proposal as a “static scheme” which could be generalized to a “dynamical” or “adaptive” scheme. Moreover, since we have observed that lower values of q tend to be better in terms of the total number of calls to the oracle, a suitable dynamical strategy could further improve the performance of the method. One could even pose a more ambitious question pursuing the scheme that minimizes the total number of oracle calls. The generalization to a dynamical scheme is not particularly difficult neither from the conceptual nor from the implementation viewpoint. Nonetheless, the proof of theoretical rigorous bounds becomes more challenging than the static scheme considered here.

Another interesting direction to extend the RQAE algorithm presented here would be that of retrieving not only the sign but the full phase of a complex amplitude. Morally, we would then move in the opposite direction with respect to the standard QAE. Namely, instead of using the QPE to perform a QAE, we would use a QAE algorithm to define an alternative QPE algorithm. Such extension would probably be challenging in terms of proving rigorous bounds for the performance of the algorithm.