HHL algorithm

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

The Harrow–Hassidim–Lloyd (HHL) algorithm is a quantum algorithm for obtaining certain limited 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.[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 system is sparse,[2] has a low condition number κ, and that the user is only interested in certain information about solution vector and not the entire vector itself, the algorithm has a runtime of O(log(N)κ2), where N is the number of variables. This offers an exponential speedup over the fastest classical algorithm, which runs in O(Nκ) (or O(Nκ) for positive semidefinite matrices).

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

Overview

[edit | edit source]

Given an N×N Hermitian matrix A and unit vector bN, the HHL algorithms prepares the quantum state |x whose amplitudes are the entries of the solution xN to the linear system Ax=b. The algorithm cannot efficiently output the solution x itself, but allows one to efficiently estimate xTMx for a Hermitian matrix M.

The algorithm first prepares the quantum state |b whose amplitudes are equal to the entries of b. Using Hamiltonian simulation, the unitary operator eiAt is applied to |b for a superposition of different times t. The algorithm then uses quantum phase estimation to decompose |b in the eigenbasis of A and find the corresponding eigenvalues λj. The state of the system after this step is approximately

j=1Nβj|uj|λj,

where uj are the eigenvectors of A and βj is the j-th coefficient of b in the eigenbasis of A.

We would then like to apply the linear map taking |λj to Cλj1|λj for some constant C. This map is not unitary and must be implemented using a quantum measurement with a nonzero probability of failure. After it succeeds, we have uncomputed the |λj register and have a state proportional to

i=1Nβiλj1|uj=A1|b=|x.

By performing the quantum measurement corresponding to M, we get an estimate of xTMx. One could use quantum tomography to retrieve all components of x, but this would require repeating the algorithm roughly N times.

Detailed description

[edit | edit source]

Assumptions and initialization

[edit | edit source]

The algorithm requires the following assumptions to hold:

  1. The algorithm requires A to be Hermitian so that it can be exponentiated into a unitary operator. If A is not Hermitian, one can define a Hermitian matrix 𝐂=[0AA0] and solve Cy=[b0] to obtain y=[0x].
  2. The algorithm requires an efficient procedure to prepare |b. It is assumed that either |b has already been prepared or there exists some B which takes some quantum state |initial to |b efficiently. Any error in the preparation of |b is ignored.
  3. The algorithm assumes that the state |ψ0 can be prepared efficiently, where |ψ0:=2/Tτ=0T1sinπ(τ+12T)|τ for some large T. The coefficients of |ψ0 are chosen to minimize a certain quadratic loss function which induces error in the Uinvert subroutine described below.
  4. The algorithm assumes that the unitary operator eiAt can be applied efficiently. This is possible using Hamiltonian simulation if A is s-sparse and efficiently row computable, meaning it has at most s nonzero entries per row which can be computed in time O(s) given a row index. One can then apply eiAt in time O(log(N)s2t).

Uinvert subroutine

[edit | edit source]

The key subroutine to the algorithm, denoted Uinvert, is defined as follows using phase estimation:

  1. Prepare |ψ0C 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 |k for k = 0, ..., T − 1. Define λk:=2πk/t0.
  4. Adjoin a three-dimensional register S in the state
|h(λk)S:=1f(λk)2g(λk)2|nothingS+f(λk)|wellS+g(λk)|illS,
  1. Reverse steps 1–3, uncomputing any garbage produced along the way.

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

The ancilla register in step 4 is needed to construct a state with inverted eigenvalues corresponding to the diagonalized inverse of A. The states 'nothing', 'well' and 'ill' are used to direct the loop body; 'nothing' indicates that the matrix inversion has not yet taken place, 'well' indicates that it has and the loop should halt, and 'ill' indicates that part of |b is in the ill-conditioned subspace of A and the algorithm cannot produce the desired inversion. Producing a state proportional to the inverse of A requires 'well' to be measured, after which the overall state collapses to the desired output.

Main loop

[edit | edit source]

The main loop follows amplitude amplification: starting with UinvertB|initial, repeatedly apply

UinvertB(I2|initialinitial|)BUinvert(I2|wellwell|).

After each iteration, S is measured and will produce a value of 'nothing', 'well', or 'ill.' The loop is repeated until 'well' is measured, which occurs with some probability p. Using amplitude amplification achieves a given error using O(1/p) queries, as opposed to 1/p using naive repetition.

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

i=1Nβiλj1|uj=A1|b=|x.

The quantum measurement corresponding to M then gives an estimate of xTMx.

Analysis

[edit | edit source]

Classical efficiency

[edit | edit source]

The best classical algorithm which produces the actual solution vector x is Gaussian elimination, which runs in O(N3) time.

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

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

Quantum efficiency

[edit | edit source]

The runtime of the quantum algorithm for solving systems of linear equations originally proposed by Harrow et al. was shown to be O(κ2logN/ε), where ε>0 is the error parameter and κ is the condition number of A. This was subsequently improved to O(κlog3κlogN/ε3) by Andris Ambainis[7] and to O(κlogN/ε) for large condition number cases by Peniel Tsemo et al,[8] and a quantum algorithm with runtime polynomial in log(1/ε) was developed by Childs et al.[9] Since the HHL algorithm maintains its logarithmic scaling in N only for sparse or low rank matrices, Wossnig et al.[10] extended the HHL algorithm based on a quantum singular value estimation technique and provided a linear system algorithm for dense matrices which runs in O(NlogNκ2) time compared to the O(NlogNκ2) of the standard HHL algorithm.

Optimality

[edit | edit source]

The performance of the matrix inversion algorithm depends on the condition number κ of A, which is the ratio of the largest and smallest eigenvalues. As κ increases A becomes closer to non-invertible, so the solution vector becomes less stable and the performance of gradient descent methods decreases. The HHL algorithm assumes that all singular values of A lie in [1/κ,1], in which case the runtime is proportional to κ2, improving the speedup further when κ is poly(log(N)).[1]

A quantum algorithm for linear systems with poly-logarithmic runtime in κ would imply that BQP is equal to PSPACE, which is believed to be false.[1]

Error analysis

[edit | edit source]

The dominant source of error is the application of eiAt using Hamiltonian simulation. If A is s-sparse this can be done with error bounded by some constant ε, which will result in an additive error in the output state |x.

The phase estimation step errs by O(1/t0) in estimating λ, which results in a relative error of O((λt0)1) in 1/λ. If λ1/κ, taking t0=O(κε) induces a final error of ε. This requires the overall runtime to be increased proportional to O(1/ε) in order to minimize error.

Experimental realization

[edit | edit source]

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.[11]

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

Proposed applications

[edit | edit source]

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.[14]
Solving linear differential equations
Berry proposed an algorithm for solving linear, time-dependent initial value problems using the HHL algorithm.[15]
Solving nonlinear differential equations
Two groups proposed[16] efficient algorithms for numerically integrating dissipative nonlinear ordinary differential equations. Liu et al.[17] utilized Carleman linearization for second order equations and Lloyd et al.[18] 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.[19]
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.[20]
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.[21]
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.[22] 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 | edit source]

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

  1. the solution vector, |b, 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 O(nc) steps the exponential advantage of HHL would vanish.
  2. the QPE phases calls for the generation of the unitary eiAt, and its controlled application. The efficiency of this step depends on the A matrix being sparse and 'well conditioned' (low κ). Otherwise, the application of eiAt would grow as O(nc) and once again, the algorithm's quantum advantage would vanish.
  3. lastly, the vector, |x, is not readily accessible. The HHL algorithm enables learning a 'summary' of the vector, namely the result of measuring the expectation of an operator x|M|x. If actual values of x are needed, then HHL would need to be repeated O(n) 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;[24] second, if the results are needed only to feed downstream matrix operations; third, if only a sample of the solution is needed.[25]

See also

[edit | edit source]

References

[edit | edit source]
  1. ^ a b c Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  2. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  3. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  4. ^ a b Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  5. ^ a b Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  6. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  7. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  8. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  9. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  10. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  11. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  12. ^ 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.
  13. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  14. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  15. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  16. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  17. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  18. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  19. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  20. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  21. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  22. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  23. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  24. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  25. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).