The Harrow–Hassidim–Lloyd (HHL) algorithm is a quantum algorithm for obtaining certain information about the solution to a system of linear equations, introduced by Aram Harrow, Avinatan Hassidim, and Seth Lloyd. Specifically, the algorithm estimates quadratic functions of the solution vector to a given system of linear equations.[1]

The algorithm is one of the main fundamental algorithms expected to provide a speedup over their classical counterparts, along with Shor's factoring algorithm and Grover's search algorithm. Assuming the linear system is sparse[2] and has a low condition number , and that the user is interested in the result of a scalar measurement on the solution vector and not the entire vector itself, the algorithm has a runtime of , where is the number of variables in the linear system. This offers an exponential speedup over the fastest classical algorithm, which runs in (or for positive semidefinite matrices).

An implementation of the quantum algorithm for linear systems of equations was first demonstrated in 2013 by three independent publications.[3][4][5] The demonstrations consisted of simple linear equations on specially designed quantum devices.[3][4][5] The first demonstration of a general-purpose version of the algorithm appeared in 2018.[6]

Overview

edit

The HHL algorithm solves the following problem: given a   Hermitian matrix   and a unit vector  , prepare the quantum state   whose amplitudes equal the elements of the solution vector   to the linear system  . In particular, the algorithm cannot efficiently output the solution   itself. However, one can still efficiently compute products of the form   for some Hermitian matrix  .

The algorithm first prepares a quantum state corresponding to   of the form

 

Next, Hamiltonian simulation is used to apply the unitary operator   to   for a superposition of different times  . The algorithm uses quantum phase estimation to decompose   into the eigenbasis of   and find the corresponding eigenvalues  . The state of the system after this decomposition is approximately

 

where   are the eigenvectors of   and  .

We would then like to apply the linear map taking   to  , where   is a normalizing constant. This linear map is not unitary, so it must be implemented using a quantum measurement with a nonzero probability of failure. After it succeeds, we have uncomputed the   register and are left with a state proportional to

 

where   is a quantum state corresponding to the desired solution vector x.

Retrieving all components of x would require the procedure be repeated at least N times. However, sometimes the full vector is not needed and one only needs the expectation value of a linear operator M acting on x. By performing the quantum measurement corresponding to M, we obtain an estimate of the product  .

Explanation

edit

Initialization and assumptions

edit

Firstly, the algorithm requires that the matrix   be Hermitian so that it can be converted into a unitary operator. In the case where   is not Hermitian, one can define a Hermitian matrix

 

The algorithm can now be used to solve   to obtain  .

Secondly, the algorithm requires an efficient procedure to prepare  , the quantum representation of b. It is assumed ether that   has already been prepared or that there exists some   which takes some quantum state   to   efficiently. Any error in the preparation of state   is ignored.

Finally, the algorithm assumes that the state   can be prepared efficiently, where

 

for some large  . The coefficients of   are chosen to minimize a certain quadratic loss function which induces error in the   subroutine described below.

Hamiltonian simulation

edit

Hamiltonian simulation is used to transform the Hermitian matrix   into a unitary operator, which can then be applied at will. This is possible if A is s-sparse and efficiently row computable, meaning it has at most s nonzero entries per row and given a row index these entries can be computed in time O(s). Under these assumptions, quantum Hamiltonian simulation allows   to be simulated in time  .

Uinvert subroutine

edit

The key subroutine to the algorithm, denoted  , is defined as follows and incorporates a phase estimation subroutine:

1. Prepare   on register C

2. Apply the conditional Hamiltonian evolution (sum)

3. Apply the Fourier transform to the register C. Denote the resulting basis states with   for k = 0, ..., T − 1. Define  .

4. Adjoin a three-dimensional register S in the state

 

5. Reverse steps 1–3, uncomputing any garbage produced along the way.

The phase estimation procedure in steps 1-3 allows for the estimation of eigenvalues of A up to error  .

The ancilla register in step 4 is necessary to construct a final state with inverted eigenvalues corresponding to the diagonalized inverse of A. In this register, the functions f, g, are called filter functions. The states 'nothing', 'well' and 'ill' are used to instruct the loop body on how to proceed; 'nothing' indicates that the desired matrix inversion has not yet taken place, 'well' indicates that the inversion has taken place and the loop should halt, and 'ill' indicates that part of   is in the ill-conditioned subspace of A and the algorithm will not be able to produce the desired inversion. Producing a state proportional to the inverse of A requires 'well' to be measured, after which the overall state of the system collapses to the desired state by the extended Born rule.

Main loop

edit

The body of the algorithm follows the amplitude amplification procedure: starting with  , the following operation is repeatedly applied:

 

where

 

and

 

After each repetition,   is measured and will produce a value of 'nothing', 'well', or 'ill' as described above. This loop is repeated until   is measured, which occurs with a probability  . Rather than repeating   times to minimize error, amplitude amplification is used to achieve the same error resilience using only   repetitions.

Scalar measurement

edit

After successfully measuring 'well' on   the system will be in a state proportional to

 

We can then perform the quantum measurement corresponding to M and obtain an estimate of  .

Run time analysis

edit

Classical efficiency

edit

The best classical algorithm which produces the actual solution vector   is Gaussian elimination, which runs in   time.

If A is s-sparse and positive semi-definite, then the Conjugate Gradient method can be used to find the solution vector  , which can be found in   time by minimizing the quadratic function  .

When only a summary statistic of the solution vector   is needed, as is the case for the quantum algorithm for linear systems of equations, a classical computer can find an estimate of   in  .

Quantum efficiency

edit

The runtime of the quantum algorithm for solving systems of linear equations originally proposed by Harrow et al. was shown to be  , where   is the error parameter and   is the condition number of  . This was subsequently improved to   by Andris Ambainis[7] and a quantum algorithm with runtime polynomial in   was developed by Childs et al.[8] Since the HHL algorithm maintains its logarithmic scaling in   only for sparse or low rank matrices, Wossnig et al.[9] extended the HHL algorithm based on a quantum singular value estimation technique and provided a linear system algorithm for dense matrices which runs in   time compared to the   of the standard HHL algorithm.

Optimality

edit

An important factor in the performance of the matrix inversion algorithm is the condition number  , which represents the ratio of  's largest and smallest eigenvalues. As the condition number increases, the ease with which the solution vector can be found using gradient descent methods such as the conjugate gradient method decreases, as   becomes closer to a matrix which cannot be inverted and the solution vector becomes less stable. This algorithm assumes that all singular values of the matrix   lie between   and 1, in which case the claimed run-time proportional to   will be achieved. Therefore, the speedup over classical algorithms is increased further when   is a  .[1]

If the run-time of the algorithm were made poly-logarithmic in   then problems solvable on n qubits could be solved in poly(n) time, causing the complexity class BQP to be equal to PSPACE.[1]

Error analysis

edit

Performing the Hamiltonian simulation, which is the dominant source of error, is done by simulating  . Assuming that   is s-sparse, this can be done with an error bounded by a constant  , which will translate to the additive error achieved in the output state  .

The phase estimation step errs by   in estimating  , which translates into a relative error of   in  . If  , taking   induces a final error of  . This requires that the overall run-time efficiency be increased proportional to   to minimize error.

Experimental realization

edit

While a general-purpose quantum computer does not yet exist, one can still try to execute a proof of concept implementation of the HHL algorithm. This remained a challenge for years, until three groups independently did so in 2013.

On February 5, 2013, a group led by Stefanie Barz reported an implementation of the HHL algorithm on a photonic quantum computer. The implementation used two consecutive entangling gates on the same pair of polarization-encoded qubits. Two separately controlled NOT gates were realized where the successful operation of the first was heralded by a measurement of two ancillary photons. Experimental measurements of the fidelity in the obtained output state ranged from 64.7% to 98.1% due to the influence of higher-order emissions from spontaneous parametric down-conversion.[4]

On February 8, 2013, Pan et al. reported a proof-of-concept experimental demonstration of the quantum algorithm using a 4-qubit NMR quantum computer. The implementation was tested using linear systems of 2 variables. Across three experiments, the solution vector was obtained with over 96% fidelity.[5]

On February 18, 2013, Cai et al. reported an experimental demonstration solving 2-by-2 linear systems. The quantum circuit was optimized and compiled into a linear optical network with four photonic qubits and four controlled logic gates, which were used to coherently implement the subroutines of the HHL algorithm. For various input vectors, the realization gave solutions with fidelities ranging from 0.825 to 0.993.[10]

Another experimental demonstration using NMR for solving an 8*8 system was reported by Wen et al.[11] in 2018 using the algorithm developed by Subaşı et al.[12]

Proposed applications

edit

Several concrete applications of the HHL algorithm have been proposed, which analyze the algorithm's input assumptions and output guarantees for particular problems.

Electromagnetic scattering
Clader et al. gave a version of the HHL algorithm which allows a preconditioner to be included, which can be used improve the dependence on the condition number. The algorithm was applied to solving for the radar cross-section of a complex shape, which was one of the first examples of an application of the HHL algorithm to a concrete problem.[13]
Solving linear differential equations
Berry proposed an algorithm for solving linear, time-dependent initial value problems using the HHL algorithm.[14]
Solving nonlinear differential equations
Two groups proposed[15] efficient algorithms for numerically integrating dissipative nonlinear ordinary differential equations. Liu et al.[16] utilized Carleman linearization for second order equations and Lloyd et al.[17] used a mean field linearization method inspired by the nonlinear Schrödinger equation for general order nonlinearities. The resulting linear equations are solved using quantum algorithms for linear differential equations.
Finite element method
The finite element method approximates linear partial differential equations using large systems of linear equations. Montanaro and Pallister demonstrate that the HHL algorithm can achieve a polynomial quantum speedup for the resulting linear systems. Exponential speedups are not expected for problems in a fixed dimension or for which the solution meets certain smoothness conditions, such as certain high-order problems in many-body dynamics, or some problems in computational finance. [18]
Least-squares fitting
Wiebe et al. gave a quantum algorithm to determine the quality of a least-squares fit. The optimal coefficients cannot be calculated directly from the output of the quantum algorithm, but the algorithm still outputs the optimal least-squares error.[19]
Machine learning
Many quantum machine learning algorithms have been developed, a large number of which use the HHL algorithm as a subroutine. The runtime of certain classical algorithms is often polynomial in the size and dimension of a dataset, while the HHL algorithm can give an exponential speedup in some cases. However, a line work initiated by Ewin Tang has found that for most quantum machine learning algorithms, there are classical algorithms giving the same exponential speedups with similar input assumptions.
Finance
Proposals for using HHL in finance include solving partial differential equations for the Black–Scholes equation and determining portfolio optimization via a Markowitz solution.[20]
Quantum chemistry
The linearized coupled cluster method in quantum chemistry can be recast as a system of linear equations. In 2023, Baskaran et al. proposed the use of HHL algorithm to solve the resulting linear systems.[21] The number of state register qubits in the quantum algorithm is the logarithm of the number of excitations, offering an exponential reduction in the number of required qubits when compared to using the variational quantum eigensolver or quantum phase estimation.

Implementation difficulties

edit

Recognizing the importance of the HHL algorithm in the field of quantum machine learning, Scott Aaronson[22] analyzes the caveats and factors that could limit the actual quantum advantage of the algorithm.

  1. the solution vector,  , has to be efficiently prepared in the quantum state. If the vector is not close to uniform, the state preparation is likely to be costly, and if it takes   steps the exponential advantage of HHL would vanish.
  2. the QPE phases calls for the generation of the unitary  , and its controlled application. The efficiency of this step depends on the   matrix being sparse and 'well conditioned' (low  ). Otherwise, the application of   would grow as   and once again, the algorithm's quantum advantage would vanish.
  3. lastly, the vector,  , is not readily accessible. The HHL algorithm enables learning a 'summary' of the vector, namely the result of measuring the expectation of an operator  . If actual values of   are needed, then HHL would need to be repeated   times, killing the exponential speed-up. However, three ways of avoiding getting the actual values have been proposed: first, if only some properties of the solution are needed;[23] second, if the results are needed only to feed downstream matrix operations; third, if only a sample of the solution is needed.[24]

See also

edit

References

edit
  1. ^ a b c Harrow, Aram W; Hassidim, Avinatan; Lloyd, Seth (2008). "Quantum algorithm for linear systems of equations". Physical Review Letters. 103 (15): 150502. arXiv:0811.3171. Bibcode:2009PhRvL.103o0502H. doi:10.1103/PhysRevLett.103.150502. PMID 19905613. S2CID 5187993.
  2. ^ Johnston, Eric (2019-07-03). Programming Quantum Computers: Essential Algorithms and Code Samples. O'Reilly Media. p. 267. ISBN 9781492039655.
  3. ^ a b Cai, X.-D; Weedbrook, C; Su, Z.-E; Chen, M.-C; Gu, Mile; Zhu, M.-J; Li, Li; Liu, Nai-Le; Lu, Chao-Yang; Pan, Jian-Wei (2013). "Experimental Quantum Computing to Solve Systems of Linear Equations". Physical Review Letters. 110 (23): 230501. arXiv:1302.4310. Bibcode:2013PhRvL.110w0501C. doi:10.1103/PhysRevLett.110.230501. PMID 25167475. S2CID 20427454.
  4. ^ a b c Barz, Stefanie; Kassal, Ivan; Ringbauer, Martin; Lipp, Yannick Ole; Dakić, Borivoje; Aspuru-Guzik, Alán; Walther, Philip (2014). "A two-qubit photonic quantum processor and its application to solving systems of linear equations". Scientific Reports. 4: 6115. arXiv:1302.1210. Bibcode:2014NatSR...4.6115B. doi:10.1038/srep06115. ISSN 2045-2322. PMC 4137340. PMID 25135432.
  5. ^ a b c Pan, Jian; Cao, Yudong; Yao, Xiwei; Li, Zhaokai; Ju, Chenyong; Peng, Xinhua; Kais, Sabre; Du, Jiangfeng; Du, Jiangfeng (2014). "Experimental realization of quantum algorithm for solving linear systems of equations". Physical Review A. 89 (2): 022313. arXiv:1302.1946. Bibcode:2014PhRvA..89b2313P. doi:10.1103/PhysRevA.89.022313. S2CID 14303240.
  6. ^ Zhao, Zhikuan; Pozas-Kerstjens, Alejandro; Rebentrost, Patrick; Wittek, Peter (2019). "Bayesian Deep Learning on a Quantum Computer". Quantum Machine Intelligence. 1 (1–2): 41–51. arXiv:1806.11463. doi:10.1007/s42484-019-00004-7. S2CID 49554188.
  7. ^ Ambainis, Andris (2010). "Variable time amplitude amplification and a faster quantum algorithm for solving systems of linear equations". arXiv:1010.4458 [quant-ph].
  8. ^ Childs, Andrew M.; Kothari, Robin; Somma, Rolando D. (2017). "Quantum Algorithm for Systems of Linear Equations with Exponentially Improved Dependence on Precision". SIAM Journal on Computing. 46 (6): 1920–1950. arXiv:1511.02306. doi:10.1137/16m1087072. ISSN 0097-5397. S2CID 3834959.
  9. ^ Wossnig, Leonard; Zhao, Zhikuan; Prakash, Anupam (2018). "A quantum linear system algorithm for dense matrices". Physical Review Letters. 120 (5): 050502. arXiv:1704.06174. Bibcode:2018PhRvL.120e0502W. doi:10.1103/PhysRevLett.120.050502. PMID 29481180. S2CID 3714239.
  10. ^ Cai, X. -D; Weedbrook, Christian; Su, Z. -E; Chen, M. -C; Gu, Mile; Zhu, M. -J; Li, L; Liu, N. -L; Lu, Chao-Yang; Pan, Jian-Wei (2013). "Experimental Quantum Computing to Solve Systems of Linear Equations". Physical Review Letters. 110 (23): 230501. arXiv:1302.4310. Bibcode:2013PhRvL.110w0501C. doi:10.1103/PhysRevLett.110.230501. PMID 25167475. S2CID 20427454.
  11. ^ Jingwei Wen, Xiangyu Kong, Shijie Wei, Bixue Wang, Tao Xin, and Guilu Long (2019). "Experimental realization of quantum algorithms for a linear system inspired by adiabatic quantum computing". Phys. Rev. A 99, 012320.
  12. ^ Subaşı, Yiğit; Somma, Rolando D.; Orsucci, Davide (2019-02-14). "Quantum Algorithms for Systems of Linear Equations Inspired by Adiabatic Quantum Computing". Physical Review Letters. 122 (6): 060504. arXiv:1805.10549. Bibcode:2019PhRvL.122f0504S. doi:10.1103/physrevlett.122.060504. ISSN 0031-9007. PMID 30822089. S2CID 73493666.
  13. ^ Clader, B. D; Jacobs, B. C; Sprouse, C. R (2013). "Preconditioned Quantum Linear System Algorithm". Physical Review Letters. 110 (25): 250504. arXiv:1301.2340. Bibcode:2013PhRvL.110y0504C. doi:10.1103/PhysRevLett.110.250504. PMID 23829722. S2CID 33391978.
  14. ^ Berry, Dominic W (2010). "High-order quantum algorithm for solving linear differential equations". Journal of Physics A: Mathematical and Theoretical. 47 (10): 105301. arXiv:1010.2745. Bibcode:2014JPhA...47j5301B. doi:10.1088/1751-8113/47/10/105301. S2CID 17623971.
  15. ^ Levy, Max G. (January 5, 2021). "New Quantum Algorithms Finally Crack Nonlinear Equations". Quanta Magazine. Retrieved December 31, 2022.
  16. ^ Liu, J.P.; Kolden, H.Ø.; Krovi, H.K.; Loureiro, N.F.; Trivisa, K.; Childs, A.M. (2021). "Efficient quantum algorithm for dissipative nonlinear differential equations". PNAS. 118 (35): e2026805118. arXiv:2011.03185. Bibcode:2021PNAS..11826805L. doi:10.1073/pnas.2026805118. PMC 8536387. PMID 34446548.
  17. ^ Lloyd, S.; De Palma, G; Gokler, C.; Kiani, B.; Liu, Z.W.; Marvian, M.; Tennie, F.; Palmer, T. (2020). "Quantum algorithm for nonlinear differential equations". arXiv:2011.06571 [quant-ph].
  18. ^ Montanaro, Ashley; Pallister, Sam (2016). "Quantum Algorithms and the Finite Element Method". Physical Review A. 93 (3): 032324. arXiv:1512.05903. Bibcode:2016PhRvA..93c2324M. doi:10.1103/PhysRevA.93.032324. S2CID 44004935.
  19. ^ Wiebe, Nathan; Braun, Daniel; Lloyd, Seth (2012). "Quantum Data Fitting". Physical Review Letters. 109 (5): 050505. arXiv:1204.5242. Bibcode:2012PhRvL.109e0505W. doi:10.1103/PhysRevLett.109.050505. PMID 23006156. S2CID 118439810.
  20. ^ Jacquier, Antoine (2022-10-31). Quantum Machine Learning and Optimisation in Finance: On the Road to Quantum Advantage. Packt. p. 349. ISBN 9781801817875.
  21. ^ Baskaran, N (2023). "Adapting the Harrow-Hassidim-Lloyd algorithm to quantum many-body theory". Physical Review Research. 5 (4): 043113. Bibcode:2023PhRvR...5d3113B. doi:10.1103/PhysRevResearch.5.043113.
  22. ^ Aaronson, Scott (2015). "Read the fine print". Nature Physics. 11 (4): 291–293. Bibcode:2015NatPh..11..291A. doi:10.1038/nphys3272. S2CID 122167250. Retrieved 2023-05-09.
  23. ^ Schuld, Maria (2018). Supervised Learning with Quantum Computers. Springer Publishing. p. 218. ISBN 9783319964249.
  24. ^ Schuld, Maria (2018). Supervised Learning with Quantum Computers. Springer Publishing. p. 219. ISBN 9783319964249.