1402.0660v3

Upload: ohenri100

Post on 05-Aug-2016

7 views

Category:

Documents


0 download

DESCRIPTION

Quantum Algorithms for Curve Fitting

TRANSCRIPT

  • arX

    iv:1

    402.

    0660

    v3 [

    quan

    t-ph]

    2 A

    pr 20

    14

    Quantum Algorithms for Curve FittingGuoming Wang

    Computer Science Division, University of California, Berkeley, U.S.A.

    Abstract

    We present quantum algorithms for estimating the best-fit parameters and the quality of least-squarecurve fitting. The running times of these algorithms are polynomial in logn, d, , , , 1/ and 1/,where n is the number of data points to be fitted, d is the dimension of feature vectors, is the conditionnumber of the design matrix, and are some parameters reflecting the variances of the design matrixand response vector, is the fit quality, and is the tolerable error. Different from previous quantumalgorithms for these tasks, our algorithms do not require the design matrix to be sparse, and they do com-pletely determine the fitted curve. They are developed by combining phase estimation and the densitymatrix exponentiation technique for dense Hamiltonian simulation.

    1 Introduction

    Curve fitting [2], also known as regression analysis in statistics, is the process of constructing a (simplecontinuous) curve that has the best fit to a series of data points. It can be used to understand the relationshipsamong two or more variables, and to infer values of a function where no data are available. It also provides anefficient means of data compression. Therefore, it has found numerous applications in science, engineeringand economics. How to quickly fit a large amount of data into a simple model has become an importantproblem for many tasks.

    Least squares [6] is one of the most popular methods of curve fitting. This method minimizes the sumof squared residuals, where a residual is the difference between an observed value and the value predictedby a model. Formally, we need to find the parameter vector that minimizes the quantity Fy2, whereF is the design matrix, and y is the response vector. The solution is known as = (FTF)1FTy. To computethis solution, the best classical algorithm needs to take poly (n,d) time, where n is the number of data pointsto be fitted, and d is the dimension of feature vectors (namely, F is an nd matrix).

    Recently, building upon Harrow, Hassidim and Lloyd (HHL)s quantum algorithm for solving linearsystems [10], Wiebe, Braun and Lloyd (WBL) gave several quantum algorithms for curve fitting in thecase that F is sparse [15]. Specifically, they gave a fast quantum algorithm for estimating the fit quality,and also a fast quantum algorithm for computing the best-fit parameters , but in an unconventional sense.Namely, under the assumption that there exists a high-quality fit 1 and the state proportional to y can beprepared in polylog (n) time, their algorithm produces a quantum state approximately proportional to inpoly (logn, log d,s,,1/) time, where s is the sparsity of F, is the condition number of F, and is thetolerable error. Then, by performing some measurements on this state and collecting the outcome statistics,one can learn certain properties of . However, since is a d-dimensional vector, one cannot fully determine in polylog (d) time. Thus, one cannot completely construct the fitted curve in polylog (d) time. It is also

    Email: [email protected] authors of [15] did not specify this condition explicitly. But it was implied by their assumption

    FTy= 1 in the descriptionof their algorithms.

    1

  • worth mentioning that their algorithms, along with HHLs, rely on a combination of phase estimation [11, 13]and the techniques for sparse Hamiltonian simulation [3, 8, 9, 4].

    In this paper, we present several quantum algorithms for estimating the best-fit parameters and thequality of least-square curve fitting in the general case. Namely, our algorithms can work no matter whetherF is sparse or not. The running times of our algorithms are polynomial in log n, d, , , , 1/ and 1/,where n is the number of data points to be fitted, d is the dimension of feature vectors, is the conditionnumber of the design matrix, and are some parameters reflecting the variances of the design matrix andresponse vector, is the fit quality 2, and is the tolerable error. Our algorithms run very fast when thegiven data are normal, in the sense that F is far from being singular, and the rows of F and y do not vary toomuch in their norms. Meanwhile, it is unknown whether classical algorithms can solve this case fast.

    Our algorithms differ from WBLs algorithms in several aspects. First, our algorithms do produce thefull classical description of (not just a quantum state proportional to ), so they completely determinethe fitted curve. But on the other hand, our algorithms have running times poly-logarithmic in n, but notpoly-logarithmic in d (as stated before, it is impossible to have time complexity poly-logarithmic in d in thiscase). Second, our algorithms use recent technique for dense Hamiltonian simulation, so they can solve datafitting in the general case. Finally, for estimating the best-fit parameters = (FTF)1FTy, WBLs algorithmconsists of two stages: stage 1 generates a state proportional to z := FTy, and stage 2 generates a stateproportional to = (FTF)1z. Each stage relies on invoking (a variant of) HHLs algorithm, which in turnrelies on analyzing the singular value decomposition of F or the spectral decomposition of FTF, respectively.We notice that these two decompositions are essentially the same. Hence, these two stages can be carriedout simultaneously. So our algorithm consists of only one stage, and it generates the state proportional to in one shot. This leads to a saving of running time for estimating .

    Our algorithms are developed by combining phase estimation and recent technique for dense Hamil-tonian simulation. Specifically, Lloyd, Mohseni and Rebentrost [12] introduced a density matrix exponen-tiation technique, which allows us to simulate eit by consuming multiple copies of the state . Then,by running phase estimation on ei, we can analyze the eigenvalues and eigenvectors of . They call thisphenomenon quantum self-analysis. We utilize this phenomenon as follows. First, we prepare a state proportional to FFT. Then s eigenvalues are related to the singular values of F, and its eigenvectors arethe (left) singular vectors of F. Then, the density matrix exponential technique allows us to implement eitfor any t. Next, by running phase estimation on ei starting with state |y, we effectively break |y intoseveral pieces, where each piece is either parallel to one of Fs (left) singular vectors, or orthogonal to thecolumn space of F. Then, we can perform different quantum operations on each piece of |y. This, alongwith some extra work, enables us to estimate the quality and best-fit parameters of least-square curve fitting.

    2 Preliminaries

    2.1 Notation

    Let [n] := {1,2, . . . ,n}. For any z R, let sgn (z) := 1 if z 0, and 1 otherwise.For any vector , let | := . Namely, | and are essentially the same thing, but | is used

    to denote the quantum state corresponding to , not its classical description. Furthermore, let be thenormalized version of , i.e. := /.

    For any matrix A, let C (A) be the column space of A, and let A be the projection onto C (A). Thecondition number of A, denoted by (A), is the ratio of As largest singular value to its smallest singularvalue. The operator norm of A, denoted by A, is the largest singular value of A. The trace norm of A,denoted by Atr, is the sum of the singular values of A. For any real matrix A with full column rank, the

    2The time complexity of the algorithm for estimating does not depend on 1/.

    2

  • Moore-Penrose pseudoinverse of A, denoted by A+, is defined as (AT A)1AT . Finally, for any two Hermitianmatrices A and B, we use A < B to denote that AB is positive semidefinite.

    For any quantum states 1 and 2, let

    D(1,2) :=1212tr (1)

    be the trace distance between 1 and 2. For any quantum operations E and F , let

    D(E ,F ) := max

    D((E I)() ,(F I)()) (2)

    be the distance between E and F . Here I is the identity operation on an auxiliary system of any di-mension, and can be any state of this extended system. This is a well-defined distance measure forquantum operations. It satisfies many nice properties, such as D(E I,F I) = D(E ,F ), D(E1,E3) D(E1,E2)+D(E2,E3), D(E F ,E F ) D(E ,E )+D(F ,F ), etc.

    For any quantum operation E and integer k, let Ek be the k-repetition of E , i.e. Ek := E E E ,where the number of Es on the right-hand side is k. Then, we have D(Ek,F k) k D(E ,F ).

    For any quantum state , if we say that is prepared to accuracy , it means that we actually preparea state satisfying D(,) . For any quantum operation E , if we say that E is implemented (orsimulated) to accuracy , it means that we actually implement an operation E satisfying D(E ,E ) .Note that if a quantum circuit consists of m local operations E1,E2, . . . ,Em, then in order to implement thiscircuit to accuracy , it is sufficient to implement each Ei to accuracy /m.

    We use the symbol O to suppress polylogarithmic factors. Namely, O( f (n)) = O( f (n)(log f (n))b) forsome constant b.

    2.2 Quantum toolsWe will mainly use three quantum tools. The first tool is amplitude amplification:Lemma 1 (Amplitude Amplification [5]). Suppose A is a quantum algorithm such that A |0=p |1 |1+

    1 p |0 |0 where p > 0 and |1, |0 are some normalized states. Then there exists a quan-tum algorithm A such that A uses O

    (1/

    )

    applications of A and A1, and A |0 =q |1 |1 |1+1q |0 |0 |0 where q 2/3 and |1, |0 are some normalized states.

    Namely, if A produces some good state |1 with probability at least (and we can check whether itdoes this or not), then we can amplify this probability to at least 2/3 by calling A and A1 only O(1/)times. This implies that:

    Corollary 1. Suppose A is a quantum algorithm such that A |0 = p |1 |1+

    1 p |0 |0 wherep > 0 and |1, |0 are some normalized states. Let > 0. Then there exists a quantum algorithm Athat uses O

    (log(1/)/) applications of A and A1, and A |0=q |1 |1 |1+1q |0 |0 |0

    where q 1 and |1, |0 are some normalized states.Proof. We run k = O(log(1/)) instances of the algorithm in Lemma 1 in parallel. Then by Lemma 1, weobtain the state(

    r |1 |1 |1+

    1 r |0 |0 |0)k

    = i{0,1}k

    r|i|(1 r)k|i| |i1 |i1 |i1 . . . |ik |ik |ik , (3)

    where r 2/3, i = (i1, . . . , ik), and |i| = kj=1 i j is the Hamming weight of i. Note that on the right-handside of this equation, there exists only one term that does not contain |1 (in any position), which is the

    3

  • one corresponding to i = (0, . . . ,0), and its amplitude is

    (1 r)k

    by our choice of k. Now weperform on the state the following unitary operation: On the state |i1 |i1 |i1 . . . |ik |ik |ik, it findsthe smallest j such that i j = 1, and then, unless such j does not exist, it swaps |i1 with

    i j, and swaps|i1 with

    i j. Then, for each term except the one corresponding to i = (0, . . . ,0), the first two registersafter this operation will be in the state |1 |1. Thus, the whole state after this operation can be written asq |1 |1 |1+

    1q |0 |0 |0 for some q 1 and normalized states |1, |0 (which are the

    states of the third to the last registers, conditioned on the first register being 1, 0 respectively).

    The second tool is amplitude estimation:

    Lemma 2 (Amplitude Estimation [5], Multiplicative version). Suppose A is a quantum algorithm such thatA |0 = p |1 |1+

    1 p |0 |0 where p (0,1) is unknown, and |1, |0 are some normalized

    states. Let > 0. Then there exists a quantum algorithm A that uses O(1/(p)) applications of A and

    A1, and A produces an estimate p of p such that |p p| p with probability at least 2/3.Lemma 3 (Amplitude Estimation [5], Additive version). Suppose A is a quantum algorithm such thatA |0 = p |1 |1+

    1 p |0 |0 where p (0,1) is unknown, and |1, |0 are some normalized

    states. Let > 0. Then there exists a quantum algorithm A that uses O(1/) applications of A and A1,and A produces an estimate p of p such that |p p| with probability at least 2/3.

    Our final tool is phase estimation:

    Lemma 4 (Phase Estimation [11, 13]). Suppose U is a unitary operation and | is an eigenstate of U witheigenvalue ei for some [0,2pi). Let , > 0. Then there exists a quantum algorithm A that uses a copy of| and O(log(1/)/) controlled applications of U and produces an estimate of such that || with probability at least 1.

    In Lemma 4, the parameter is called the precision (or accuracy) of phase estimation, while the pa-rameter is called the error rate of phase estimation. Since the complexity of phase estimation is onlylogarithmic in 1/, we will assume that phase estimation always outputs a satisfying | | . Al-though this is not really true, taking the error rate into account only increases the complexities of ouralgorithms by some poly-logarithmic factors.

    3 Least-square curve fittingGiven a set of n points {(xi,1,xi,2, . . . ,xi,k,yi)}ni=1 in Rk+1, the goal of curve fitting is to find a simple con-tinuous function that has the best fit to these data points. Formally, let xi := (xi,1,xi,2, . . . ,xi,k)T , for i [n].Also, let f j : Rk R be some simple function, for j [d]. Then we want to approximate yi with a functionof xi of the form

    f (x,) :=d

    j=1

    f j(x) j, (4)

    where := (1,2, . . . ,d)T are some parameters 3. In the least-square approach, we find the optimal pa-rameters by minimizing the sum of squared residuals, i.e.

    E :=n

    i=1

    | f (xi,) yi|2. (5)

    3The most common case is that each f j is a monomial of x, and hence f is a polynomial of x.

    4

  • Now, let F be the n d matrix such that Fi, j = f j(xi), for i [n] and j [d]. F is called the designmatrix, and Fi := ( f1(xi), f2(xi), . . . , fd(xi))T is called the i-th feature vector, for i [n]. In addition, lety = (y1,y2, . . . ,yn)T . y is called the response vector. Then one can see that

    E = Fy2 . (6)

    Hence, the best-fit parameters are given by

    = F+y = (FTF)1FTy. (7)

    Correspondingly, the fitted values of y are

    y = F = F(FTF)1FTy = Fy, (8)

    and the residuals are = y y = (IF(FTF)1FT)y = (IF)y. (9)

    Geometrically, y is exactly the projection of y onto C (F). To measure the quality of this fit, we introducethe quantity

    :=y2y2 . (10)

    Namely, is the squared cosine of the angle between y and y. The larger is, the better the fit is. Note thaty and hence

    E := 2 = F y2 = (1)y2 . (11)We have assumed rank(F) = d (and hence FTF is invertible) in the above statement. This is a reasonable

    assumption, because if otherwise, either the f js are linearly dependent (e.g. f2 = 2 f1), or we simply do nothave enough data to do the fitting. In each case, a revision of F is required.

    3.1 Our modelWe will study quantum algorithms for estimating the best-fit parameters and the fit quality , in thefollowing model. We assume that F is given as a quantum oracle OF defined as

    OF |i | j |0= |i | jFi, j , i [n], j [d]. (12)

    Namely, OF takes a row index i and column index j as input, and returns the value of Fi, j. In addition, weassume that y is given as a quantum oracle Oy defined as

    Oy |i |0= |i |yi , i [n]. (13)

    Namely, Oy takes a row index i as input, and returns the value of yi. An algorithm in this model has accessto OF, Oy as well as their inverses. Its query complexity is defined as the number of calls to OF, Oy andtheir inverses. Its time complexity is defined as its query complexity plus the number of additional one- andtwo-qubit gates used.

    Without loss of generality, throughout this paper we assume that tr(FTF

    )= ni=1 dj=1 |Fi, j|2 = 1 and

    y= 1. This can be achieved by scaling the original F and y appropriately. Clearly, this rescaling does notchange the difficulty of estimating or .

    5

  • 4 Warmup: Simulating eiFFTt

    Before describing our algorithms for curve fitting, we present a quantum algorithm for simulating eiFFTt .This will become a crucial component of our algorithms.

    Let = FFT. (14)

    Then, < 0 and tr () = tr(FTF

    )= 1. So we can view as a density matrix. In what follows, we will first

    show how to prepare the quantum state . Then we will show how to simulate eit by using multiple copiesof .

    Let

    |F=n

    i=1

    |i |Fi=n

    i=1

    d

    j=1

    Fi, j |i | j , (15)

    where |Fi = dj=1 Fi, j | j. Then, since |F2 = i=1 dj=1 |Fi, j|2 = 1, |F is a normalized quantum state.Furthermore, the reduced state of |F on the first subsystem is =FFT. This implies that, to (approximately)produce the state , it is sufficient to (approximately) produce the state |F.Lemma 5. Suppose Fi for any i [n]. Let = /. Then |F can be prepared to accuracy > 0in O(polylog (n) d log(1/)) time.Proof. Let UF be the unitary operation defined as

    UF |i |0= |i |Fi , i [n]. (16)

    Clearly, UF can be implemented in O(d) time (since we can query Fi,1,Fi,2, . . . ,Fi,d and compute Fi fromthem).

    Next, let VF be the unitary operation defined as

    VF |i |0= |i Fi , i [n]. (17)

    (Recall that by definition Fi = Fi/Fi.) We have that:Claim 1. VF can be implemented to accuracy > 0 in O(d polylog (1/)) time.Proof. We will describe a quantum circuit that maps |i |0 to |i |i such that i Fi = O(), for anyi [n]. This ensures that this circuit implements VF to accuracy O(), as desired

    Pick an integer M = (d/2

    ). Fix any i [n]. Let Si, j = jl=1 F2i, j, for j [d]. Note that Si,d = Fi2.

    Also, let Si,0 = 0. Then, let Mi, j = MSi, j/Si,d, for 0 j d. Then let Zi, j = Mi, j Mi, j1, for j [d].Finally, let

    |i=dj=1

    i, j | j=dj=1

    sgn(Fi, j)

    Zi, jM

    | j . (18)

    Then, by construction, we have

    |i, j Fi, j|= O(

    1M

    )= O

    (d

    ), j [d], (19)

    where Fi, j = Fi, j/Fi. It follows that i Fi= O(), as claimed.Now we describe how to map |i |0 to |i |i. For any k [M], let hi(k) = ( j, t) if Mi, j1 < k Mi, j

    and k = Mi, j1 + t. Note that for any k [M], a unique ( j, t) satisfies this condition. So the function hi iswell-defined. Consider the following procedure:

    6

  • 1. We create the state |i (d

    j=1

    Fi, j) by using O(d) queries to OF.2. We compute the Mi, js for j [d], obtaining the state

    |i(d

    j=1

    Fi, j)( dj=1

    Mi, j). (20)

    3. We append a register in the state 1MM

    k=1|k, obtaining the state

    |i (d

    j=1

    Fi, j)( dj=1

    Mi, j)(

    1M

    M

    k=1

    |k)

    (21)

    4. We compute hi(k) for each k [M], obtaining the state

    |i (d

    j=1

    Fi, j)( dj=1

    Mi, j)(

    1M

    M

    k=1

    |hi(k))= |i (

    dj=1

    Fi, j)( dj=1

    Mi, j)(

    1M

    d

    j=1

    Zi, j

    t=1

    | j, t)

    (22)

    5. We perform the unitary operation that maps | j(

    1Zi, j

    Zi, j

    t=1|t)

    to | j |0 on the last register, obtainingthe state

    |i (d

    j=1

    Fi, j)( dj=1

    Mi, j)(

    d

    j=1

    Zi, jM

    | j,0)

    (23)

    6. We multiply the phase of each term by the sign of Fi, j, obtaining the state

    |i(d

    j=1

    Fi, j)( dj=1

    Mi, j)(

    d

    j=1

    sgn (Fi, j)

    Zi, jM

    | j,0)

    (24)

    7. We uncompute the Mi, js by undoing step 2, then uncompute the Fi, js by undoing step 1. Eventually,we obtain the sttae

    |i |i= |i(

    d

    j=1

    sgn(Fi, j)

    Zi, jM

    | j)

    (25)

    as desired.

    Clearly, this algorithm runs in O(d polylog (M)) = O(d polylog (1/)) time, as claimed.

    Since the time complexity of implementing VF is only poly-logarithmic in the inverse accuracy, we fromnow on assume that VF is implemented perfectly (taking the accuracy issue into account only increases thetime complexities of our algorithms by a poly-logarithmic factor).

    Now consider the following algorithm for preparing |F:

    7

  • 1. We prepare the state 1n ni=1 |i |0 |0, and convert it into the state

    1n

    n

    i=1

    |i Fi |Fi (26)

    by calling VF and UF once.

    2. We append a qubit in the state |0, and perform the controlled-rotation

    |z |0 |z(

    z1 |1+1 z22 |0) (27)on the last two registers (recall that Fi ), obtaining the state

    1n

    n

    i=1

    |i Fi |Fi(Fi1 |1+

    1Fi2 2 |0

    ). (28)

    3. We measure the last qubit in the standard basis. Then conditioned on seeing outcome 1, the rest of thestate becomes proportional to

    n

    i=1

    |iFi Fi |Fi= n

    i=1|i |Fi |Fi . (29)

    Furthermore, since Fi = /, the probability of seeing outcome 1 is (1/2

    ).

    4. We uncompute the |Fi by performing the inverse of UF on the first and third registers, obtainingthe state |F= ni=1 |i |Fi.

    5. The above procedure succeeds only with probability (1/2

    ). We use amplitude amplification to

    raise this probability to 1O(). This ensures that we have prepared |F to accuracy O(). ByCorollary 1, this requires O( log(1/)) repetitions of the above procedure and its inverse.

    Clearly, this algorithm has time complexity O(polylog (n) d log(1/)), as claimed.

    Lemma 5 immediately implies:

    Lemma 6. Suppose Fi for any i [n]. Let = /. Then can be prepared to accuracy > 0in O(polylog (n) d log(1/)) time.

    Now we review the density matrix exponentiation technique of [12]. This technique allows us to simulateeit by consuming multiple copies of the state :

    Lemma 7 (Implicit in [12]). Let be a D-dimensional quantum state. Then there exists a quantum algorithmthat simulates eit to accuracy O() using O

    (t2/

    )copies of and O(log D t2/) additional one- and two-

    qubit gates.

    Proof. This algorithm is based on the following observation. Let be any D-dimensional state. Then wehave

    Ex() := tr1(eiSx ()eiSx)= + ix[,]+O(x2) , (30)

    where S is the swap operator, i.e. S |i | j= | j |i for any i, j [D]. Meanwhile, we have

    Fx() := eix eix = + ix[,]+O(x2). (31)

    8

  • Therefore,D(Ex(),Fx()) = O

    (x2). (32)

    In fact, one can check that for any state (with a D-dimensional subsystem),D((Ex I)(),(Fx I)()) = O

    (x2). (33)

    This implies thatD(Ex,Fx) = O

    (x2). (34)

    Now we use n repeated applications of Et/n to simulate eit . Since

    D(Ent/n,Fn

    t/n) = D(Ent/n, e

    it) = O(t2/n

    ), (35)

    in order to make D(Ent/n, eit) = O(), it is sufficient to set n =

    (t2/

    ). This algorithm consumes n =

    O(t2/

    )copies of . Furthermore, it needs to implement eiSt/n once in each application of Et/n. As shown

    in [7], eiSt/n can be implemented in O(logD) time. Thus, this algorithm uses O(t2/) copies of andO(n logD) = O(log D t2/) additional one- and two-qubit gates.

    The following lemma says that we do not need to prepare exactly in order to simulate eit well. Agood approximation of would be sufficient.Lemma 8. Let and be D-dimensional quantum states such that = O(/t). Then there existsa quantum algorithm that simulates eit to accuracy O() using O

    (t2/

    )copies of and O(logD t2/)

    additional one- and two-qubit gates.Proof. By Lemma 7, there exists a quantum algorithm that simulates eit to accuracy using O(t2/)copies of and O

    (logD t2/) additional two-qubit gates. So it is sufficient to prove that

    D(eit ,eit) = O() . (36)

    Claim 2. Let A and B be any two Hermitian matrices. TheneiA eiB= O(AB).

    Proof. Let C(x) = eiAxeiB(1x), for x [0,1]. Then

    eiA eiB = 1

    0

    dC(x)dx dx =

    10

    ieiAx(AB)eiB(1x)dx. (37)

    Thus, eiA eiB 10

    eiAx(AB)eiB(1x)dx 10ABdx = AB . (38)

    Claim 2 implies that eit eit= O(t)= O() . (39)It follows that D(eit ,eit) = O(), as desired.

    Combining Lemma 6 and Lemma 8, we obtain:Lemma 9. Suppose Fi for any i [n]. Let = /. Then eit can be simulated to accuracy > 0 in O(polylog (n) dt2/) time.Proof. We use the algorithm in Lemma 6 to prepare to accuracy O(/t). Then we use the algorithm inLemma 8 to simulate eit to accuracy O(). By Lemma 6 and Lemma 8, this algorithm has time complexityO(polylog (n) dt2/), as claimed.

    9

  • 5 Quantum algorithms for estimating the best-fit parametersIn this section, we present two quantum algorithms on the estimation of =(FTF)1FTy. The first algorithmproduces an estimate of

    (i.e. the norm of ), and the second one produces an estimate of := / (i.e. the normalized version of ). Then, by multiplying them together, we obtain an estimate of = .

    Before describing our algorithm, it is beneficial to consider the singular value decomposition of F andwrite as the linear combination of the (right) singular vectors of F. Formally, suppose F has the singularvalue decomposition

    F =d

    j=1

    s ju jv j , (40)

    where s1 s2 sd are the singular values of F. Then we have

    tr(FTF

    )=

    d

    j=1

    s2j = 1, (41)

    Let (F) = sd/s1. Then1

    d s1 s2 sd d . (42)

    Meanwhile, we have = FFT =

    dj=1

    s2ju ju j . (43)

    This implies thatC () = C (F) = span ({|u1 , |u2 , . . . , |ud}) . (44)

    Therefore, the 1-eigenspace of ei is exactly Ker(F).Now suppose |y= dj=1 j

    u j. Then, by y= 1, we get = y2 =

    d

    j=1

    2j . (45)

    Furthermore, we have = (FTF)1FT |y= dj=1

    js1jv j , (46)

    which implies that 2 = dj=1

    2js2j . (47)

    Then it follows from Eq.(42) and Eq.(45) thatd2

    2 d2. (48)

    The following lemma will be also useful for our algorithms. It gives an upper bound on the time com-plexity of preparing the state |y.Lemma 10. Suppose |yi| , for any i [n]. Let = /. Then |y can be prepared to accuracy > 0in O(polylog (n) log(1/)) time.Proof. Consider the following algorithm:

    10

  • 1. We prepare the state 1n ni=1 |i |0 and call Oy once, obtaining the state

    1n

    n

    i=1

    |i |yi . (49)

    2. We append a qubit in the state |0, and perform the controlled-rotation

    |z |0 |z(

    z1 |1+1 z22 |0) , (50)on the last two registers (recall that |yi| ), obtaining the state

    1n

    n

    i=1

    |i |yi(

    yi1 |1+

    1 y2i 2 |0). (51)

    3. We measure the last qubit in the standard basis. Then conditioned on seeing outcome 1, the rest of thestate is proportional to

    n

    i=1

    yi |i |yi (52)

    Furthermore, since |yi| = /, the probability of seeing this outcome is (1/2).4. We uncompute the |yi by uncalling OF, obtaining the state |y= ni=1 yi |i.5. The above procedure succeeds only with probability

    (1/2

    ). We use amplitude amplification to

    raise this probability to 1O(). This ensures that we have prepared |y to accuracy O(). ByCorollary 1, this requires O( log(1/)) repetitions of steps 1-4 and their inverses.

    Clearly, this algorithm has time complexity O(polylog (n) log(1/)), as claimed.

    Since the time complexity of preparing |y is only poly-logarithmic in the inverse accuracy, we fromnow on assume that |y is prepared perfectly (taking the accuracy issue into account only increases the timecomplexities of our algorithms by some poly-logarithmic factors).

    5.1 Quantum algorithm for estimating Theorem 1. Suppose Fi , for any i [n], and F+ 1/a, F b. Moreover, suppose |yi| , for any i [n]. Let = /, = / and = b/a. Then

    can be estimated to a relative error > 0 with probability at least 2/3 in O

    (polylog (n) (+d36/(3))/()

    )time.

    Proof. Consider the following algorithm (for convenience, we assume that phase estimation is perfect in thefollowing description, and we will take the error of phase estimation into account later):

    1. We use the algorithm in Lemma 10 to prepare the state |y.2. We run phase estimation on ei starting with |y, obtaining the state

    d

    j=1

    ju js2j+ | |0 . (53)

    11

  • 3. We append a qubit in the state |0 and perform the controlled-rotation

    |z |0 |z a

    z|1+

    1 a

    2

    z|0 , (54)

    on the last two registers (note that s j a), obtaining a state proportional to

    dj=1

    ju js2j

    (a

    s j|1+

    1 a

    2

    s2j|0)+ | |0 , (55)

    4. We measure the last qubit in the standard basis. Then, conditioned on seeing outcome 1, the rest ofthe state becomes proportional to

    dj=1

    js1ju js2j . (56)

    Furthermore, the probability of getting outcome 1 is

    q := a2d

    j=1

    2js2j = a

    22 . (57)Since dj=1 2j = , and s j b = a, we have q =

    (/2

    ).

    5. We use amplitude estimation to estimate q to a relative error O() with probability at least 2/3. Sinceq =

    (/2

    ), this requires O

    (/(

    ))

    repetitions of the above procedure and its inverse.

    6. Let q be the estimate of q. Then we return

    q/a as the estimate of.

    Now we take the error of phase estimation into account, and analyze the time complexity of this algo-rithm. In step 2, we do not get the eigenphase s2j exactly, but instead get some (random) j s2j (althoughphase estimation singles out the eigenphase 0 perfectly). This implies that we only obtain the states insteps 2-4 approximately. Since we want to estimate q to a relative error O(), we need to make surethat

    j s2j = O(s2j). Then, by s2j 1/(d2), we need to set the precision of phase estimation to beO(/(d2)

    ). It follows that we need to simulate eit to accuracy O

    (/2

    ) 4 for t = O(d2/) duringphase estimation. This can be done in O(polylog (n) d(d2/)2/(/2))= O(polylog (n) d36/(3))time by Lemma 9. Meanwhile, |y can be prepared in O(polylog (n) ) time by Lemma 10. Therefore,one iteration of steps 1-3 takes O(polylog (n) (+ d36/(3))) time. Since amplitude estimation re-quires O(/(

    )) repetitions of steps 1-4 and their inverses, this algorithm takes O(polylog (n) (+

    d36/(3))/(

    )) time, as claimed.

    Remark: We can reduce the failure probability of the algorithm in Theorem 1 to arbitrarily small > 0by repeating this algorithm O(log(1/)) times and taking the median of the estimates obtained.

    4We want the disturbance caused by the imperfection of simulating eit to be O(q).

    12

  • 5.2 Quantum algorithm for estimating Suppose = (1, 2, . . . , d)T . Our algorithm for estimating consists of two parts. The first part estimates|1|, |2|, . . . , |d | (i.e. the norm of each entry). The second part determines sgn

    (1), sgn

    (2), . . . , sgn

    (d)

    (i.e. the sign of each entry). Both parts depend on the following algorithm for producing the state .Proposition 1. Suppose Fi , for any i [n], and F+ 1/a, F b. Moreover, suppose |yi| , for any i [n]. Let = /, = / and = b/a. Then

    can be prepared to accuracy > 0 in O

    (polylog (n) (+d36/(3))/

    )time.

    Before proving this proposition, let us recall the singular value decomposition of F as shown in Eq.(40).Although |v1, |v2, . . . , |vd are d-dimensional vectors, we from now on consider them as n-dimensionalvectors (that is, we embed Rd into Rn in the natural way). Now let

    + =dj=1

    s2jw+j w+j ,

    =dj=1

    s2jwj wj ,

    (58)

    where w+j = 12(|0 v j+ |1 u j) ,wj = 12(|0 v j|1 u j) . (59)

    Both + and are 2n-dimensional quantum states. The following lemma says that they can be preparedquickly:

    Lemma 11. Suppose Fi , for any i [n]. Let = /. Then can be prepared to accuracy > 0 in O(polylog (n) d log(1/)) time.Proof. Consider the following algorithm:

    1. We use the algorithm in Lemma 5 to prepare the state

    |F=n

    i=1

    d

    j=1

    Fi, j |i | j=d

    j=1

    s ju jv j , (60)

    where in the second step we perform the Schmidt decomposition of |F, which corresponds to thesingular value decomposition of F.

    2. We append a qubit in the state |= 12(|0 |1) and an n-dimensional register in the state |0, andperform the addressing operation

    |i1 |i0 | j |0 |i1 |i0 | ji j , i0, i1 [n], j {0,1}. (61)

    Then we obtain the state

    12

    d

    j=1

    s ju jv j(|0 v j|1 u j)= d

    j=1s ju jv jwj . (62)

    Then the reduced state of this state on the last register is = dj=1 s2jwj wj , as desired.

    13

  • By Lemma 5, this algorithm has time complexity O(polylog (n) d log(1/)), as claimed.

    Combining Lemma 8 and Lemma 11, we obtain:

    Lemma 12. Suppose Fi , for any i [n]. Let = /. Then eit can be simulated to accuracy > 0 in O

    (polylog (n) dt2/) time.

    Proof. We use the algorithm in Lemma 11 to prepare to accuracy O(/t). Then we use the algorithm inLemma 8 to simulate eit to accuracy O(). It follows from Lemma 11 and Lemma 8 that this algorithmhas time complexity O

    (polylog (n) dt2/), as claimed.

    Now, let

    = + =d

    j=1

    s2j(w+j w+j wj wj ) . (63)

    Namely, has eigenvalues s2js and eigenvectorswj s. We can simulate eit by composing the simula-

    tions of ei+t and eit :

    Lemma 13. Suppose Fi , for any i [n]. Let = /. Then eit can be simulated to accuracy > 0 in O

    (polylog (n) dt2/) time.

    Proof. We use Suzukis method [14] for simulating ei(A+B)t , where A, B are arbitrary Hermitian matricessatisfying A ,B 1. This method works as follows. Define a function S2k(x) recursively: let

    S2(x) = eiAx/2eiBxeiAx/2, (64)and let

    S2k(x) = [S2k2(pkx)]2S2k2((14pk)x)[S2k2(pkx)]2 (65)where pk = (441/(2k1))1 for any k 2. Then we have:Claim 3 ([14]). For any k N, ei(A+B)xS2k(x) = O(|x|2k+1) . (66)

    This implies that for any k N,ei(A+B)t (S2k ( tn))n= O

    (t2k+1

    n2k

    ). (67)

    To make the right-hand side O(), we need to set n = (

    t1+12k 12k

    ). Then, (S2k(t/n))n is the product

    of O(n) = O(

    t1+12k 12k

    )terms, where each term is of the form eiAt j or eiBt j for some t j = O(t/n) =

    O(

    12k t 12k)

    .

    Now we simulate eit by setting A = + and B = . We need to implement each term, which is ofthe form ei+t j or eit j for t j = O

    ( 12k t 12k

    ), to accuracy O(/n) = O

    (1+ 12k t1 12k

    ). By Lemma 13, this

    takes O(

    polylog (n) dt1 12k /1 12k)

    time. Since there are totally O(

    t1+12k 12k

    )terms, this algorithm has

    time complexity O(polylog (n) dt2/), as claimed. (It is interesting that this complexity is independent

    of k. But a better way to simulate eiT using multiple copies of might change this fact.)

    14

  • Now we have all the ingredients to prove Proposition 1:

    Proof of Proposition 1. Suppose |y= dj=1 ju j, where dj=1 2j = . Then we have

    |1 |y=d

    j=1

    j |1u j= 12

    d

    j=1

    j(w+j wj ) . (68)

    Consider the following algorithm for preparing (again, we assume that phase estimation is perfect

    in the following description, and we will take the error of phase estimation into account later):1. We prepare the state |1 |y 5 by using the algorithm in Lemma 10.2. We run phase estimation on ei starting with |1 |y, obtaining the state

    12

    d

    j=1

    j(w+j s2j wj s2j)+ |1 | |0 . (69)

    3. We perform the measurement {|00| , I|00|} on the last register. Then, conditioned on seeing theoutcome corresponding to I|00|, the state becomes proportional to

    12

    d

    j=1

    j(w+j s2j wj s2j) (70)

    Furthermore, the probability of seeing this outcome is = dj=1 2j .4. We append a qubit in the state |0, and perform the controlled-rotation

    |z |0 |za|z|1/2

    z|1+

    1 a

    2|z|z2

    |0 , (71)

    on the last two registers (note that s j a), obtaining a state proportional to12

    dj=1

    j[w+j s2j(as1j |1+1a2s2j |0) wj s2j(as1j |1+1a2s2j |0)]

    (72)5. We measure the last qubit in the standard basis. Then, conditioned on seeing outcome 1, the rest of

    the state is proportional to

    12

    d

    j=1

    j(

    s1jw+j s2j+ s1j wj s2j) (73)

    Furthermore, since s j b = a, the probability of seeing outcome 1 is (1/2

    ).

    6. We uncompute thes2js and s2js by undoing phase estimation, obtaining a state proportional to

    12

    d

    j=1

    js1j(w+j + wj )= d

    j=1 js1j |0

    v j= |0 . (74)The reduced state of this state on the second register is

    , as desired.5The dimension of the first register is 2.

    15

  • 7. The above procedure only succeeds with probability q := (/2

    ). We using amplitude amplifica-

    tion to raise this probability to 1O(). This ensures that we have prepared to accuracy O().By Corollary 1, this requires O

    ( log(1/)/

    )

    repetitions of steps 1-6 and their inverses.

    Now we take the error of phase estimation into account, and analyze the time complexity of thisalgorithm. In step 2, we do not get the eigenphase s2j exactly, but instead get some (random) j s2j (although phase estimation singles out the eigenphase 0 perfectly). This implies that we only ob-tain the states in steps 2-6 approximately. Since we want to prepare

    to accuracy O(), we needto make sure that | j s2j | = O

    (s2j)

    . Since s2j 1/(d2), we need to set the precision of phase esti-mation to be O

    (/(d2)

    ). This implies that we need to simulate eit to accuracy O

    (/2

    ) 6 for t =O(d2/

    )during phase estimation. Then by Lemma 13, this takes O

    (polylog (n) d(d2/)2/(/2))=

    O(polylog (n) d36/(3)) time. Meanwhile, by Lemma 10, it takes O(polylog (n) ) time to prepare

    |y. Thus, one iteration of steps 1-6 takes O(polylog (n) (+d36/(3))) time. Since amplitude am-plification requires O

    ( log(1/)/

    )

    repetitions of steps 1-6 and their inverses, this algorithm has time

    complexity O(

    polylog (n) (+d36/(3))/)

    , as claimed.

    We remark that the final state of the algorithm in Proposition 1 is of the form

    | :=p |1 |0 |+1 p(|1 |1 |+ |0 |0 |0+ |0 |1 |1) (75)

    where p = 1O(), = (1, 2, . . . , d)T satisfies = 1 and j j = O( j), and | is some

    normalized state, and |, |0, |1 are some unnormalized states 7. This fact will be useful for the followingalgorithms for estimating | j| and sgn

    ( j).

    Proposition 2. Suppose Fi , for any i [n], and F+ 1/a, F b. Moreover, suppose |yi| , for any i [n]. Let = /, = / and = b/a. Then for any j [d],

    j can be estimatedup to an additive error > 0 with probability at least 2/3 in O(polylog (n) (+d36/(3))/(2))time.

    Proof. Consider the following algorithm:1. We run the algorithm in Proposition 1 to get the state | in Eq.(75).2. We measure the first three registers of | in the standard basis. Then the probability of seeing

    outcome (1,0, j) is q j := p j2.

    3. We use amplitude estimation to estimate q j up to an additive error O(2)

    with probability at least 2/3.This requires O

    (1/2

    )repetitions of the above procedure and its inverse.

    4. Let qj be the estimate of q j. Then we return

    qj as the estimate of j.

    Now we prove the correctness of this algorithm. Since p = 1O() andj j = O(), we haveq j j= O(). Meanwhile, with probability at least 2/3, we have qj q j= O(2), which implies

    6We want to the disturbance caused by the imperfection of simulating eit at most O(q).7The dimensions of |, |0 and |1 are d times of the dimension of |.

    16

  • thatqj q j = O(). Then it follows that qj j qj q j+ q j | j| = O(), as

    desired.Now we analyze the time complexity of this algorithm. By Proposition 1, one iteration of steps 1-2 takes

    O(

    polylog (n) (+d36/(3))/)

    time. Since amplitude estimation requires O(1/2

    )repetitions

    of steps 1-2 and their inverses, this algorithm takes O(polylog (n) (+ d36/(3))/(2)) time, asclaimed.

    Proposition 3. Suppose Fi , for any i [n], and F+ 1/a, F b. Moreover, suppose |yi| , for any i [n]. Let = /, = / and = b/a. Then for any j [d], if

    j , then sgn( j)can be determined correctly with probability at least 2/3 in O(polylog (n) 3(+d34/3)/(3/2)) time.

    Proof. Determining sgn( j) is more complicated than determining j. The problem is that the algorithmin Proposition 1 only produces a quantum state

    and one cannot know the global phase of a quantum state8. To overcome this problem, we modify the design matrix F and response vector y, such that we know for

    sure about the sign of j0 , for some j0. Then we only need to decide whether the sign of other j agreeswith that of i0 .

    Formally, let us pick an nd matrix G = (Gi, j) such that: Gs columns are orthogonal and have norm 1/d. Namely, ni=1 Gi, jGi, j = j, j/d, for any j, j [d]. |Gi,1|= 1/

    nd, for any i [n];

    There exists constants c1 and c2 such that c1/n dj=1 |Gi, j|2 c2/n, for any i [n].Such matrix exists and can be easily constructed (e.g. using the Hadamard matrix). Furthermore, let z bean n-dimensional vector defined as z = (z1,z2, . . . ,zn)T =

    (G1,1,G2,1, . . . ,Gn,1)T . Namely, z equals thefirst column of G times

    .Now let

    F =12

    (F 00 G

    ), y =

    11+d1

    2(

    yz

    ). (76)

    Then, we have

    := ((F)TF)1(F)Ty =

    21+d1

    2

    12.

    .

    .

    d0.

    .

    .

    0

    . (77)

    Namely, is proportional to the concatenation of = (1, 2, . . . , d)T and := ( ,0, . . . ,0)T . Note that

    we know that the (d + 1)-th entry of is always positive. Furthermore, let = (1, 2, . . . ,

    2d) be the

    normalized version of . Then one can see that j = j/

    2 for j [d], d+1 = 1/

    2, and j = 0 for8However, we can decide, e.g. sgn

    (1 2

    ), provided that |1| and |2| are big enough.

    17

  • j > d + 1. To decide sgn( j) = sgn(j) for j [d], our strategy is to decide whether j + d+1 is largerthan d+1 or not.

    By construction, we have tr((F)TF

    )= y= 1. Let Fi = (Fi,1,Fi,2, . . . ,Fi,d), for i [n]. Then let =

    mini[n] Fi and = maxi[n] Fi. Then we have = (), = O(), and hence := / = O().Moreover, since all the singular values of G are 1/

    d, by Eq.(42), we know that all the singular values

    of F are between (1/a) and O(b). It follows that := (F) = O(). Finally, let = mini[n] |yi| and = maxi[n] |yi|. Then we have min(,

    /nd)1+

    2 /d , max(,

    /nd)1+

    2 /d .(78)

    Then by Eq.(48), we get := / = O(2/). Using these facts and Proposition 1, we can prepare astate of the form

    | :=p |1 |0 |+1 p(|1 |1 |+ |0 |0 |0+ |0 |1 |1) (79)

    where p = (1), = (1, 2 , . . . ,

    2d)

    T satisfies = 1 and j j = O( j), and | is some nor-

    malized state, and |, |0, |1 are some unnormalized states, in O(polylog (n) 3(+d34/3)/3/2)time.

    Now suppose we measure the first two registers of the state in Eq.(79) in the standard basis. Then withprobability (1), we obtain the outcome (1,0). Accordingly, the rest of the state becomes

    |. Then,let j= 12(| j |d +1), for any j [d]. Then, we measure the state

    in the basis {+ j , j}{|i : i [2d], i 6 { j,d+1}}, and estimate the probability of seeing the outcome corresponding to + j. Onecan see that this probability is

    q :=(j +

    d+1)

    2

    2 (

    j + d+1)

    2

    2= q :=

    ( j +1)24

    . (80)

    In fact, we have |q q| = O(). Now, if j , we would have q (1 )/4; if j , we wouldhave q (1+ )/4. Therefore, by estimating q up to an additive error O(), we can distinguish thesetwo cases and hence determine sgn

    ( j). We can estimate q using amplitude estimation, and this requires

    O(1/) repetitions of the above procedure and its inverse. Therefore, the time complexity of this algorithmis O(polylog (n) 3(+d34/3)/(3/2)), as claimed.

    In the above argument, we have assumed that we know exactly. In fact, we only need to estimate

    it to a relative error O(). This would cause at most O() disturbance to the above argument. By Theorem1, estimating

    to a relative error O() takes O(polylog (n) (+d36/(3))/()) time, which isnegligible compared to the other part of this algorithm.

    Remark: We can reduce the failure probability of the algorithms in Proposition 2 and Proposition 3to arbitrarily small > 0 by repeating them O(log(1/)) times and taking the median or majority of theestimates obtained.

    Combining Proposition 2 and Proposition 3, we obtain:

    18

  • Theorem 2. Suppose Fi , for any i [n], and F+ 1/a, F b. Moreover, suppose |yi| , for any i [n]. Let = /, = / and = b/a. Then there exists a quantum algorithm that producesan estimate of such that

    with probability at least 2/3, in O(polylog (n) d1.5(d/+2/+6d5/(4))/(

    )) time.

    Proof. Consider the following algorithm: For each j [d]:

    1. We use the algorithm in Proposition 2 to estimate j up to an additive error /(8d) with

    probability at least 11/(6d).2. Let j be the estimate of

    j. Then: If j /(8

    d), then we use the algorithm in Proposition 3 (setting = /(8d)) to de-

    termine sgn(

    j)

    with probability at least 11/(6d). Let j be the output of this algorithm.Then we set j = j j;

    Otherwise, we set j to be + j or j arbitrarily.

    Let S = { j [d] : j /(8

    d)}. Then, with probability at least 2/3, we have j j 8d , j [d], (81)

    and j = sgn

    ( j), j S. (82)

    This implies that j j 8d , j S. (83)Meanwhile, we have j 4d , j 6 S. (84)Thus, j j 2d , j 6 S. (85)It follows that 2 =

    jS

    j j2 +j 6S

    j j2 264 + 2

    4 2. (86)

    This proves the correctness of this algorithm.Now we analyze the time complexity of this algorithm. For each j [d], step 1 takes O(polylog (n)

    d(+d4.56/(3))/(2

    )) time by Proposition 2, and step 2 takes O(polylog (n) 3d(+d4.54/3)/(3/2)) time by Proposition 3. Since we need to do step 1 and 2 for every j [d], this algorithm has timecomplexity O(polylog (n) d1.5(d/+2/+6d5/(4))/()), as claimed.

    Remark: We can reduce the failure probability of the algorithm in Theorem 2 to arbitrarily small > 0by making the success probabilities in steps 1 and 2 to be 1O(/d). The running time of this algorithmwill be increased by a factor of O(log(d/)).

    19

  • 6 Quantum algorithm for estimating the fit qualitySo far, we have presented two quantum algorithms on the estimation of the best-fit parameters . One maynotice that they both rely on some knowledge of the fit quality . Now we show that this is without loss ofgenerality, because can be estimated quickly, as indicated by the following theorem:

    Theorem 3. Suppose Fi , for any i [n]. Moreover, suppose |yi| , for any i [n]. Let = /, = / and = (F). Then can be estimated up to an additive error > 0 with probability atleast 2/3 in O

    (polylog (n) (+d34/)/) time.

    Proof of Theorem 3. Our strategy for estimating = y2 = F |y2 is as follows. We prepare the state|y, and perform the projective measurement {F, IF} on it, and estimate the probability of seeing theoutcome corresponding to F. The measurement {F, IF} is implemented by running phase estimationon ei and checking whether the eigenphase is close to 0 or not.

    Specifically, suppose |y = dj=1 ju j. Consider the following algorithm for estimating = y2 =

    dj=1 2j (again, we assume that phase estimation is perfect in the following description, and we will take theerror of phase estimation into account later):

    1. We use the algorithm in Lemma 10 to prepare the state |y.2. We run phase estimation on ei starting with |y, obtaining the state

    d

    j=1

    ju js2j+ | |0 , (87)

    3. We perform the measurement {|00| , I|00|} on the second register. Then, conditioned on seeingthe outcome corresponding to I|00|, the state becomes proportional to

    d

    j=1

    ju js2j (88)

    Furthermore, the probability of seeing this outcome is q := dj=1 2j = .4. We use amplitude estimation to estimate q up to an additive error O() with probability at least 2/3.

    This requires O(1/) repetitions of the above procedure and its inverse.

    Now we take the error of phase estimation into account, and analyze the time complexity of this al-gorithm. In step 2, we do not get the eigenphase s2j exactly, but get some (random) j s2j (althoughphase estimation can single out the eigenphase 0 perfectly). This implies we only obtain the states insteps 2-3 approximately. Since we want to estimate q to a relative error O(), we need to make sure that j s2j s2j/3 (so that j 6= 0). Since s2j 1/(d2), we need to set the precision of phase estimation tobe O

    (1/(d2)

    ). It follows that we need to simulate eit to accuracy O() 9 for t = O

    (d2

    )during phase

    estimation. This can be done in O(polylog (n) d(d2)2/) = O(polylog (n) d34/) time by Lemma

    9. Meanwhile, it takes O(polylog (n) ) time to prepare |y by Lemma 10. Thus, one iteration of steps 1-3takes O(polylog (n) (+d34/)) time. Since amplitude estimation requires O(1/) repetitions of steps1-3 and their inverses, this algorithm takes O(polylog (n) (+d34/)/) time, as claimed.

    Remark: We can reduce the failure probability of the algorithm in Theorem 3 to arbitrarily small > 0by repeating this algorithm O(log(1/)) times and taking the median of the estimates obtained.

    9We want the disturbance caused by the imperfection of simulating eit to be at most O().

    20

  • 7 Conclusion and open problemsTo summarize, we have presented several quantum algorithms for estimating the best-fit parameters and thequality of least-square curve fitting. The running times of these algorithms are polynomial in logn, d, , ,, 1/ and 1/, where n is the number of data points to be fitted, d is the dimension of feature vectors, is the condition number of the design matrix, and are some parameters reflecting the variances of thedesign matrix and response vector respectively, is the fit quality, and is the tolerable error. Different fromprevious quantum algorithms for these tasks, our algorithms do not require the design matrix to be sparse,and they do completely determine the fitted curve. They are developed by combining phase estimation andthe density matrix exponentiation technique for nonsparse Hamiltonian simulation.

    Our work raises many interesting questions:First, our work suggests that quantum algorithms might be able to solve curve fitting exponentially faster

    than classical algorithms. But we do not really prove it. Instead, we show that there exist extremely fastquantum algorithms for curve fitting when d, , and are reasonably small. But it is unknown whetherclassical algorithms can solve this case very fast. It would be interesting to study the biggest possible gapbetween our algorithms and classical algorithms.

    Second, in this paper we focus on giving upper bounds for the quantum complexity of curve fitting. Itis also worth studying lower bounds for the quantum complexity of the same problem. In particular, is itpossible to generate the state

    to accuracy > 0 in poly (logn, log d,,,,1/,1/) time? Note thatthis complexity is poly-logorithmic in both n and d. If such an algorithm exists, it might have immediateimplications to certain physical problems, as suggested by [15]. We suspect that no such algorithm exists.Can this be proved under some complexity assumption, say, BQP 6= PSPACE?

    Third, Ambainis [1] has introduced a technique called variable-time amplitude amplification and usedit to improve HHLs algorithm for solving linear systems. Since our algorithms for estimating the best-fitparameters have some similarity with HHLs algorithm, is it possible to use his technique to improve ouralgorithms as well?

    Fourth, as one can see, our algorithms crucially depend on the ability to simulate the evolutions ofnonsparse Hamiltonians. Here we have used the density matrix exponentiation method of [12]. It would beinteresting to know whether this method is optimal. Namely, is there a more efficient way of simulating eitby consuming multiple copies of ? If so, it would lead to the improvement of our algorithms.

    Finally, it would be interesting to apply our algorithms to solve practical problems in many fields.

    Acknowledgement

    This work was supported by NSF Grant CCR-0905626 and ARO Grant W911NF-09-1-0440.

    References

    [1] A. Ambainis. Variable time amplitude amplification and a faster quantum algorithm for solvingsystems of linear equations. In Proc. 29th STACS, pages 636-647, 2012.

    [2] S. L. Arlinghaus. PHB Practical Handbook of Curve Fitting. CRC Press, 1994.[3] D. W. Berry, G. Ahokas, R. Cleve and B. C. Sanders. Efficient quantum algorithms for simulating

    sparse Hamiltonians. Communications in Mathematical Physics 270, 359 (2007).[4] D. W. Berry and A. M. Childs. Black-box Hamiltonian simulation and unitary implementation.

    Quantum Information and Computation 12, 29 (2012).

    21

  • [5] G. Brassard, P. Hoyer, M. Mosca and A. Tapp. Quantum amplitude amplification and estimation.arXiv:quant-ph/0005055.

    [6] O. Bretscher. Linear Algebra With Applications, 3rd ed. Upper Saddle River NJ: Prentice Hall.

    [7] A. M. Childs, R. Cleve, E. Deotto, E. Farhi, S. Gutmann and D. A. Spielman. Exponential algorithmicspeedup by quantum walk. In Proc. 35th ACM STOC, pages 59-68, 2003.

    [8] A. M. Childs. On the relationship between continuous- and discrete-time quantum walk. Communi-cations in Mathematical Physics 294, pages 581-603 (2010).

    [9] A. M. Childs and R. Kothari. Simulating sparse Hamiltonians with star decompositions. LectureNotes in Computer Science 6519, pages 94-103 (2011).

    [10] A. W. Harrow, A. Hassidim and S. Lloyd. Quantum algorithm for linear systems of equations.Physical Review Letters 103, 150502 (2009).

    [11] A. Y. Kitaev. Quantum measurements and the Abelian Stabilizer Problem. arXiv:quant-ph/9511026.[12] S. Lloyd, M. Mohseni and P. Rebentrost. Quantum principal component analysis. arXiv: 1307.0401.[13] D. Nagaj, P. Wocjan and Y. Zhang. Fast amplification of QMA. Quantum Information and Compu-

    tation 9, 1053 (2009).[14] M. Suzuki. Fractal decomposition of exponential operators with applications to many-body theories

    and Monte Carlo simulations. Physical Letters A 146(6), pages 319-323, 1990.[15] N. Wiebe, D. Braun and S. Lloyd. Quantum data fitting. Physical Review Letters 109, 050505 (2012).

    22

    1 Introduction2 Preliminaries2.1 Notation2.2 Quantum tools

    3 Least-square curve fitting3.1 Our model

    4 Warmup: Simulating eiFFTt5 Quantum algorithms for estimating the best-fit parameters5.1 Quantum algorithm for estimating "026B30D "026B30D 5.2 Quantum algorithm for estimating

    6 Quantum algorithm for estimating the fit quality7 Conclusion and open problems