Black-Box Quantum State Preparation with Inverse Coefficients

Black-box quantum state preparation is a fundamental building block for many higher-level quantum algorithms, which is applied to transduce the data from computational basis into amplitude. Here we present a new algorithm for performing black-box state preparation with inverse coefficients based on the technique of inequality test. This algorithm can be used as a subroutine to perform the controlled rotation stage of the Harrow-Hassidim-Lloyd (HHL) algorithm and the associated matrix inversion algorithms with exceedingly low cost. Furthermore, we extend this approach to address the general black-box state preparation problem where the transduced coefficient is a general non-linear function. The present algorithm greatly relieves the need to do arithmetic and the error is only resulted from the truncated error of binary string. It is expected that our algorithm will find wide usage both in the NISQ and fault-tolerant quantum algorithms.


I. INTRODUCTION
Black-box quantum state preparation, first developed by Grover [1], is a widely used quantum computational primitive.It can be taken as input to higher-level quantum algorithms or invoked as intermediate subroutine to transform the amplitudes of quantum state [2][3][4][5][6][7][8][9].Recently, Sanders et al. [10] made an important breakthrough that almost avoids the need to do arithmetic in black-box state preparation and reduces the complexity greatly.Along with the subsequent works inspired by it [11,12], these improvements bring the black-box state preparation and the related quantum algorithms much closer to reality.
Sanders et al. [10] discussed two kinds of state preparation problem, the "linear coefficients" problem and the "root coefficients" problem.The first problem is to transform an amplitude vector   problem is the Harrow-Hassidim-Lloyd (HHL) algorithm [2], which is actually to inverse the matrix.In HHL, after the phase estimation stage, the eigenvalues are entangled as , then the next step is to transform the state into , which is indeed the "inverse coefficients" problem.
The "inverse coefficients" problem of black-box quantum state preparation is typically solved by controlled rotation, which requires quantum computers to calculate the reciprocals and arcsines and results into a major contributor to the complexity [13].Even by invoking the algorithm for "linear coefficients" problem as subroutine, one still need to do the arithmetic for reciprocal.The reciprocal can be calculated using the Newton-Raphson iteration method [13][14][15] which brings much complexity.
Here we propose a new method to address the "inverse coefficients" problem.By extending the idea of inequality test introduced in Ref. [10], our method can solve the inverse-coefficients problem with only one multiplication operation.The quantum multiplication operation is much easy than inverse operation, and there exists a vast amount of literature providing various efficient quantum circuits for the multiplication operation [16][17][18].Therefore, the present method improves the cost greatly.
The paper is organized as follows.In Section II, the algorithm for solving the "inverse coefficients" problem is presented.In Section III, we generalize the method to form a framework for solving more general nonlinear coefficients of black-box quantum state preparation.Conclusions are given in Section IV.

II. ALGORITHM FOR INVERSE COEFFICIENTS PROBLEM
In the scenario for black-box state preparation, the amplitudes vector to be loaded are unknown a priori and are supposed to be accessed through an oracle (black-box).
More specifically, suppose the amplitude vector is with the element αi being expressed as a binary string, then there exists an oracle Uo giving the following state The amplitude elements αi are encoded coherently in the second register with n-bit precision.Note that the dimension of the amplitude vector d may be not a power of 2, so the uniformly superposition state  cannot be created trivially.Since such superposition state is widely used in quantum algorithms, in the appendix we present a simple and efficient quantum circuit for producing such state with at most one round of standard amplitude amplification operation [19].It is assumed that the oracle Uo can be invoked, as required, any number of times and the complexity is O (1).In practice, oracle Uo would be a QRAM [20] or a quantum circuit.
Starting with Eq. ( 1), the task of black-box state preparation with inverse coefficients is to produce a target state as where the l2 norm is the normalization coefficient.In linear coefficients case, the value of αi is restricted into the interval of (0, 1), that is, the binary point is located at the left most position of the binary string (0.αi).However, in inverse coefficients case the target amplitude 1/αi should be scaled into (0, 1), so the invoked αi is assumed to be a positive integer here.That is to say, the binary point is located at the right most position of the binary string (αi.0).
The basic idea of our method comes from the simple multiplication relation between the input x and its inverse 1/x, i.e. x•(1/x)=1.If the inverse 1/x is replaced by a smaller number y<1/x, then the multiplication satisfies x•y<1; If the inverse 1/x is replaced by a larger number y, the multiplication satisfies x•y>1.Naturally, the relation x•y<1 or x•y>1 is equivalent to the inequality test in linear coefficients case [10].So our method is to perform the inequality test αi•j<1 where j is the computational basis in a uniformly superposition state.Count the number of j that satisfies the inequality and it is approximated to the value 1/αi.
As it is in the HHL algorithm, a normalization constant C that is no more than the minimum of all elements, i.e.C≤αmin, can be induced to increase the amplitude in practice.Then the inverse turns to C/αi and the inequality test turns to αi•j<C.Same as αi, C is chosen to be a positive integer, then C/αi is a fraction belonging to (0, 1].So the uniformly distributed j is a positive real number.The circuit representation of our method is shown in Fig. 1, and the details of the state evolution is as follows.The algorithm consists of the following five steps: (1) First is to initialize the registers.Assume the data αi in Reg.B invoked from Uo is truncated in n-bit precision; prepare a uniformly superposition state on Reg.A using m parallel Hadamard gates; encode the constant C in Reg.C with m+n qubits.Then we have (2) Perform multiplication operation between Reg.B and Reg.A to obtain (3) Compare the value of the bit-string of Reg.A with that of Reg.C, and record the result into the flag qubit.As mentioned above, the position of the binary point should be taken into consideration.Specifically, if αi•j < C, namely j < C/αi, then the indication  , and then we have where | is an unnormalized state orthogonal to A flag |0   .
(5) Carry out measurement on Reg.A and flag qubit, if the result is , then the state of Regs.I and B is Finally reset Reg.B using the inverse oracle The above approach can be adapted to perform the division operation easily.In this case, the inputs are positive real values αi and βi, and the target is to transduce the division βi/αi into the amplitude.We assume βi ≤ αi, so the division belongs to the interval (0,1].Other values of βi/αi should be first scaled into (0,1).In order to perform the division βi/αi, one only need to initialize the Reg.C in Fig. 1 by βi, and the result is finally encoded as Now we analyze the complexity and error of our approach.We compare the complexity in the terms of the number of multiplication operations.Typically, the reciprocal is calculated by the Newton-Raphson iteration method [13].The number of iterations is log2log2(1/ε) with ε being the error of the result.In each iteration step of Newton-Raphson method, there contains two multiplication operations forward, and the un-computation of the entire forward multiplication operations needs to be done to eliminate the garbage qubits after 1/αi is transduced into amplitude.That is the total number of multiplications to reach the result precision 1-ε is about 4log2log2(1/ε) based on Newton-Raphson method while our method, as shown in Fig. 1, needs only 2 multiplications and can reach arbitrary precision.The precision of our method is simply bounded by the precision of j in Reg.A, i.e. 2 -m , when the data αi is assumed to be precise.If αi is regarded as a n-bit truncated input, m can also be set to guarantee a much smaller error induced by the truncation of αi.Additionally, the Newton-Raphson method needs to prepare an appropriate initial state and log2log2(1/ε) more times qubits.
A significant difference between the Newton-Raphson iteration method and the present one should be pointed out further: the effect of the un-computation process.The

III. EXTENSION OF THE ALGORITHM
We can extend our approach to be a framework for solving general problems of black-box quantum state preparation.In this case, starting with Eq. ( 1), one would aim to create such a state where f(x) is a non-linear function and Typically, this general problem would be done through two steps, first performing , and then transducing the amplitude by the approach of black-box state preparation with linear coefficients.Obviously, here the forward map from αi to f(αi) is performed to get the function values.In contrast, in the above algorithm for the inverse coefficients problem, the reciprocal is calculated utilizing the backward map.That is, in Fig. 1, first all possible approximations of reciprocal 1/αi are prepared in the computational basis of the uniformly superposition state on Reg.A, and then the target value is picked out by multiplying them with αi and performing inequality test.It implies that combining the inverse map and the inequality test would result into a better way of transducing the f(x) values.Specifically, without loss of generality, supposing that f(x) is expressed as a composite function, namely y = f(x) = h(g(x)), first we prepare all possible values of h -1 (y) and g(x) on two registers, respectively, and then perform inequality test between the two registers to pick out the function value y.
Our extension algorithm is shown schematically in Fig. 2. The state evolution is similar as that of Fig. 1.The unitaries 1 h U  and g U are used to perform the h -1 (y) and g(x) functions, respectively.After this step, the state is Then after the comparison operation, the state evolves into Finally, applying uncomputation and parallel H gates, the target state shown in Eq. ( 8) is obtained.
out the corresponding basis j as it is done in the case of inverse coefficients.Therefore, in our approach the sequential square root and inverse operations to evaluate f(αi) are replaced by parallelized square and multiplication operations.The complexity is reduced greatly.The precision of the resulted amplitude, i.e. f(αi), is also bounded by the precision of j in Reg.A, i.e. 2 -m , when αi is a precise data.
We expect that more concrete functions will be found that can be transduced into amplitude using our approach.More exploration of practical usage of our algorithm is also necessary.We leave these for the future work.

IV. CONCLUSIONS
In this work, we present an algorithm for black-box quantum state preparation with inverse coefficients based on inequality test method.The reciprocal information is first encoded in a uniformly superposition state, then through just two multiplication operations and one inequality test the target reciprocal can be transduced into amplitude.Furthermore, we extend this method for general problem of black-box state preparation with a general non-linear function f(x) being the coefficients.By expressing f(x) as y = f(x) = h(g(x)), the forward map g(x) and backward map h -1 (y) can be evaluated on two registers in parallel, then the inequality test is applied to pick out the target value f(x).The error is mainly the truncated error because of the finite qubits of registers.Our algorithm relieves the need of arithmetic greatly, although cannot avoid it, and makes significant reductions to the complexity of performing general black-box state preparation.
In quantum computing, the information can be encoded in basis, phase and amplitude, and can be transduced to each other among them [13][14][15]19,[22][23][24].Here we discuss the conversion from basis to amplitude.We expect that combining the present algorithm with other conversion approaches will result into a more versatile tool for quantum information processing.

ACKNOWLEDGEMENTS
The present work is supported by the National Natural Science Foundation of China (Grant No. 12005212 and 61575180) and the National Laboratory for Marine Science and Technology (Qingdao).

APPENDIX
In the appendix, we present the approach to prepare the uniformly superposition state  .When d is a power of 2, i.e. d=2 l , l parallel Hadamard gates are enough to produce the state unif |  .For the general case that 2 l-1 <d<2 l , the state can be created based on the inequality test and amplitude amplification as schematically shown in Fig. 3.
Fig. 3 The overall circuit to prepare the general uniformly superposition state with the number of computational basis being not a power of 2. AA represents the standard amplitude amplification.
The procedure of this algorithm goes as follows: (1) Apply (2) Perform the comparison operation between Regs.D and I, and mark the relation on ancillary qubit anc1.Then the state evolves into (3) Append another qubit anc2 and perform Ry(θ) rotation with θ being 2 2arccos 2 l d  , then we obtain The Ry(θ) rotation is used to adjust the magnitude of the amplitude to set the stage for the following amplitude amplification.The target state is indicated by anc1 anc2 |0 |0  , that is, Eq. ( 11) can be rewritten as where | contains the states orthogonal to anc1 anc2

|0 |0
 .Now the probability of the target state is 1/4, hence just one round of standard amplitude amplification is enough to precisely increase the success probability to be one [19].Note that in practice the comparator can be designed quite simple because the binary |d is known beforehand.The qubits and non-Clifford Toffoli gates can be reduced in different schemes [18,25,26].This algorithm has linear qubit and gate complexity with small constant factor and needs no measurement operations which promise its widely unrestricted applications.
According to the normalization property, our algorithm can produce a perfect the angle θ1/2 corresponding to 1/2 lays on the small interval of π/6 which has a derivative approaching 23 in practice.That is to say, the angle θ1/2 involves an error belonging to (ε0/8, ε0).Finally, by one round of standard amplitude amplification, the final angle belongs to the interval (π/2-3ε0, π/2-3ε0/8), leading to the final value ranging from cos(3ε0) to cos(3ε0/8).On the interval (π/2-3ε0, π/2+3ε0), the derivative of the sine function approaches 0 which means the impact of ε0 in sin(π/2) is much smaller, i.e.

.
. In the present work, we introduce the "inverse coefficients" problem that is to create the state The most famous example of "inverse coefficients"

Fig. 1
Fig. 1 The overall circuit for transducing the inverse coefficients into amplitude.The module Mult performs the multiplication operation, and Comp is used to test the inequality.The initial data | Undo the multiplication operation on Reg.B and Reg.A, and reset Reg. C. Apply another m parallel Hadamard gates on Reg.A to extract A |0 m   basis 2 m C/αi times indicated by flag |0 state of |1i   is approximated by the forward multiplication operations using Newton-Raphson method, and un-computed back to |0 at the end.This un- computation operation is just used to eliminate the intermediate garbage qubits.In contrast, the present method picks out the first number of 2 m C/αi basis indicated by flag |0 in the uniformly superposition state in Reg.A by the modules Mult.and Comp.Up to now, the amplitude of .(5).Until Mult + and another m parallel Hadamard operations (the un-computation) are performed in Reg.A, see Eq. (6), the residual proportional amplitude of intermediate state.Finally, the target 1/αi is transduced into amplitude.So the uncomputation is used to not only eliminate the intermediate garbage qubits but also calculate 1/αi.
log ld    Hadamard gates on Reg.I, and prepare value d on Reg.D. Then we have the state 21

for
to be perfect 1 because the value of angle θ cannot be obtained precisely in most cases.In the following we analyze the impact of the error induced by the angle θ to the success probability of Ry(θ) rotation, the value of cos(θ/2) belongs to (1 2 ,1 2 ) and the absolute value of its derivative belongs to ( 2 2 , 3 2) .Suppose the error of rotation angle θ is ε0, then we have the following inequality, . We employ the second order truncated Taylor series of cosine function cosx>1-x 2 /2 to upper bound the error εu in the final amplitude of