The Harrow–Hassidim–Lloyd algorithm or HHL algorithm is a quantum algorithm for numerically solving a system of linear equations, designed by Aram Harrow, Avinatan Hassidim, and Seth Lloyd. The algorithm estimates the result of a scalar measurement on the solution vector to a given linear system of equations.[1]
\kappa
O(log(N)\kappa2)
N
O(N\kappa)
O(N\sqrt{\kappa})
An implementation of the quantum algorithm for linear systems of equations was first demonstrated in 2013 by three independent publications. 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]
Due to the prevalence of linear systems in virtually all areas of science and engineering, the quantum algorithm for linear systems of equations has the potential for widespread applicability.[7]
The HHL algorithm tackles the following problem: given a
N x N
A
\vecb\inRN
|x\rangle
\vecx\inRN
A\vecx=\vecb
|x\rangle
\vecx
\vecx
\langlex|M|x\rangle
M
First, the algorithm represents the vector
\vecb
N | |
|b\rangle=\sum | |
i=1 |
bi|i\rangle.
Next, Hamiltonian simulation techniques are used to apply the unitary operator
eiAt
|b\rangle
t
|b\rangle
A
λj
The state of the system after this decomposition is approximately:
N | |
\sum | |
j=1 |
\betaj|uj\rangle|λj\rangle,
where
uj
A
N | |
|b\rangle=\sum | |
j=1 |
\betaj|uj\rangle
We would then like to perform the linear map taking
|λj\rangle
-1 | |
Cλ | |
j|λ |
j\rangle
C
|λj\rangle
N | |
\sum | |
i=1 |
-1 | |
\beta | |
j|u |
-1 | |
j\rangle=A |
|b\rangle=|x\rangle,
where
|x\rangle
x
\langlex|M|x\rangle
Firstly, the algorithm requires that the matrix
A
A
C=\begin{bmatrix} 0&A\\ A\dagger&0\end{bmatrix}.
As
C
Cy=\begin{bmatrix} b\\ 0\end{bmatrix}
y=\begin{bmatrix} 0\\ x\end{bmatrix}
Secondly, the algorithm requires an efficient procedure to prepare
|b\rangle
B
|initial\rangle
|b\rangle
|b\rangle
|b\rangle
Finally, the algorithm assumes that the state
|\psi0\rangle
|\psi0\rangle:=\sqrt{2/T}
T-1 | |
\sum | |
\tau=0 |
\sin\pi\left(\tfrac{\tau+\tfrac{1}{2}}{T}\right)|\tau\rangle
for some large
T
|\psi0\rangle
Uinvert
Hamiltonian simulation is used to transform the Hermitian matrix
A
eiAt
O(log(N)s2t)
The key subroutine to the algorithm, denoted
Uinvert
1. Prepare
C | |
|\psi | |
0\rangle |
2. Apply the conditional Hamiltonian evolution (sum)
3. Apply the Fourier transform to the register C. Denote the resulting basis states with
|k\rangle
λk:=2\pik/t0
4. Adjoin a three-dimensional register S in the state
S | |
|h(λ | |
k)\rangle |
:=
2 | |
\sqrt{1-f(λ | |
k) |
-
2} | |
g(λ | |
k) |
|nothing\rangleS+f(λk)|well\rangleS+g(λk)|ill\rangleS,
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
\epsilon
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
|b\rangle
The body of the algorithm follows the amplitude amplification procedure: starting with
UinvertB|initial\rangle
UinvertBR
\dagger | |
initB |
\dagger | |
U | |
invertR |
succ,
where
Rsucc=I-2|well\rangle\langlewell|
and
Rinit=I-2|initial\rangle\langleinitial|.
After each repetition,
S
|well\rangle
p
1 | |
p |
O\left( | 1 |
\sqrt{p |
After successfully measuring 'well' on
S
N | |
\sum | |
i=1 |
\betai
-1 | |
λ | |
j |
|uj\rangle=A-1|b\rangle=|x\rangle.
Finally, we perform the quantum-mechanical operator corresponding to M and obtain an estimate of the value of
\langlex|M|x\rangle
The best classical algorithm which produces the actual solution vector
\vec{x}
O(N3)
If A is s-sparse and positive semi-definite, then the Conjugate Gradient method can be used to find the solution vector
\vec{x}
O(Ns\kappa)
|A\vec{x}-\vec{b}|2
When only a summary statistic of the solution vector
\vec{x}
\vec{x}\daggerM\vec{x}
O(N\sqrt{\kappa})
The runtime of the quantum algorithm for solving systems of linear equations originally proposed by Harrow et al. was shown to be
O(\kappa2logN/\varepsilon)
\varepsilon>0
\kappa
A
O(\kappalog3\kappalogN/\varepsilon3)
log(1/\varepsilon)
N
O(\sqrtNlogN\kappa2)
O(NlogN\kappa2)
\kappa
A
A
A
1 | |
\kappa |
\kappa2
\kappa
poly(log(N))
If the run-time of the algorithm were made poly-logarithmic in
\kappa
Performing the Hamiltonian simulation, which is the dominant source of error, is done by simulating
eiAt
A
\varepsilon
|x\rangle
The phase estimation step errs by
O\left( | 1 |
t0 |
\right)
λ
O\left( | 1 |
λt0 |
\right)
λ-1
λ\ge1/\kappa
t0=O(\kappa\varepsilon)
\varepsilon
O\left( | 1 |
\varepsilon |
\right)
While there does not yet exist a quantum computer that can truly offer a speedup over a classical computer, implementation of a "proof of concept" remains an important milestone in the development of a new quantum algorithm. Demonstrating the quantum algorithm for linear systems of equations remained a challenge for years after its proposal until 2013 when it was demonstrated by Cai et al., Barz et al. and Pan et al. in parallel.
Published in Physical Review Letters 110, 230501 (2013), Cai et al. reported an experimental demonstration of the simplest meaningful instance of this algorithm, that is, solving
2 x 2
On February 5, 2013, Stefanie Barz and co-workers demonstrated the quantum algorithm for linear systems of equations on a photonic quantum computing architecture. This 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. Barz et al. found that 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 nuclear magnetic resonance quantum information processor. The implementation was tested using simple linear systems of only 2 variables. Across three experiments they obtain the solution vector with over 96% fidelity.[5]
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]
Quantum computers are devices that harness quantum mechanics to perform computations in ways that classical computers cannot. For certain problems, quantum algorithms supply exponential speedups over their classical counterparts, the most famous example being Shor's factoring algorithm. Few such exponential speedups are known, and those that are (such as the use of quantum computers to simulate other quantum systems) have so far found limited practical use due to the current small size of quantum computers. This algorithm provides an exponentially faster method of estimating features of the solution of a set of linear equations, which is a problem ubiquitous in science and engineering, both on its own and as a subroutine in more complex problems.
Clader et al. provided a preconditioned version of the linear systems algorithm that provided two advances. First, they demonstrated how a preconditioner could be included within the quantum algorithm. This expands the class of problems that can achieve the promised exponential speedup, since the scaling of HHL and the best classical algorithms are both polynomial in the condition number. The second advance was the demonstration of how to use HHL to solve for the radar cross-section of a complex shape. This was one of the first end to end examples of how to use HHL to solve a concrete problem exponentially faster than the best known classical algorithm.[14]
Dominic Berry proposed a new algorithm for solving linear time dependent differential equations as an extension of the quantum algorithm for solving linear systems of equations. Berry provides an efficient algorithm for solving the full-time evolution under sparse linear differential equations on a quantum computer.[15]
Two groups proposed[16] efficient algorithms for numerically integrating dissipative nonlinear ordinary differential equations. Liu et al.[17] utilized Carleman linearization technique for second order equations and Lloyd et al.[18] employed a mean field linearization method inspired by nonlinear Schrödinger equation for general order nonlinearities. The resulting linear equations are solved using quantum algorithms for linear differential equations.
The Finite Element Method uses large systems of linear equations to find approximate solutions to various physical and mathematical models. Montanaro and Pallister demonstrate that the HHL algorithm, when applied to certain FEM problems, can achieve a polynomial quantum speedup. They suggest that an exponential speedup is not possible in problems with fixed dimensions, and for which the solution meets certain smoothness conditions.
Quantum speedups for the finite element method are higher for problems which include solutions with higher-order derivatives and large spatial dimensions. For example, problems in many-body dynamics require the solution of equations containing derivatives on orders scaling with the number of bodies, and some problems in computational finance, such as Black-Scholes models, require large spatial dimensions.[19]
Wiebe et al. provide a new quantum algorithm to determine the quality of a least-squares fit in which a continuous function is used to approximate a set of discrete points by extending the quantum algorithm for linear systems of equations. As the number of discrete points increases, the time required to produce a least-squares fit using even a quantum computer running a quantum state tomography algorithm becomes very large. Wiebe et al. find that in many cases, their algorithm can efficiently find a concise approximation of the data points, eliminating the need for the higher-complexity tomography algorithm.[20]
See main article: Quantum machine learning.
Machine learning is the study of systems that can identify trends in data. Tasks in machine learning frequently involve manipulating and classifying a large volume of data in high-dimensional vector spaces. The runtime of classical machine learning algorithms is limited by a polynomial dependence on both the volume of data and the dimensions of the space. Quantum computers are capable of manipulating high-dimensional vectors using tensor product spaces and thus are well-suited platforms for machine learning algorithms.[21]
The quantum algorithm for linear systems of equations has been applied to a support vector machine, which is an optimized linear or non-linear binary classifier. A support vector machine can be used for supervised machine learning, in which training set of already classified data is available, or unsupervised machine learning, in which all data given to the system is unclassified. Rebentrost et al. show that a quantum support vector machine can be used for big data classification and achieve an exponential speedup over classical computers.[22]
In June 2018, Zhao et al. developed an algorithm for performing Bayesian training of deep neural networks in quantum computers with an exponential speedup over classical training due to the use of the quantum algorithm for linear systems of equations,[6] providing also the first general-purpose implementation of the algorithm to be run in cloud-based quantum computers.[23]
Proposals for using HHL in finance include solving partial differential equations for the Black–Scholes equation and determining portfolio optimization via a Markowitz solution.[24]
In 2023, Baskaran et al. proposed the use of HHL algorithm to quantum chemistry calculations, via the linearized coupled cluster method (LCC).[25] The connection between the HHL algorithm and the LCC method is due to the fact that the latter can be recast in the form of system of linear equations. A key factor that makes this approach useful for quantum chemistry is that the number of state register qubits is the natural logarithm of the number of excitations, thus offering an exponential suppression in the number of required qubits when compared to variational quantum eigensolver or the quantum phase estimation algorithms. This leads to a 'coexistence across scales', where in a given quantum computing era, HHL-LCC could be applied to much larger systems whereas QPE-CASCI could be employed for smaller molecular systems but with better accuracy in predicting molecular properties. On the algorithmic side, the authors introduce the 'AdaptHHL' approach, which circumvents the need to expend an ~Ο(N3) classical overhead associated with fixing a value for the parameter 'c' in the controlled-rotation module of the algorithm.
Recognizing the importance of the HHL algorithm in the field of quantum machine learning, Scott Aaronson[26] analyzes the caveats and factors that could limit the actual quantum advantage of the algorithm.
|b\rangle
O(nc)
ei
A
\kappa
ei
O(nc)
|x\rangle
\langlex|M|x\rangle
\vec{x}
O(n)