If the eigenvalues of are with , exact quantum phase estimation on uses controlled powers . Their Hamiltonian simulation times reach . Counting each supplied controlled power as one oracle query is valid in that oracle model, but does not prove a polynomial time implementation from generic sparse-matrix access. In the ordinary HHL algorithm, one instead chooses finite precision appropriate to the output error and the condition number, or exploits additional structure giving efficient access to the needed powers.
On a positive eigenvalue label and a clean quantum ancilla, the HHL algorithm applies a quantum variable rotation with angle , where :
Uncomputation of the eigenvalue register followed by conditioning on flag one multiplies each input eigenvector amplitude by . If is normalized, the success probability is . Choosing from a valid condition number bound gives success probability at least .
Let denote the coherent exact quantum phase estimation unitary operator from the preceding part, with the data quantum register written first. For every eigenvector of ,
because and lies in , with no phase-aliasing ambiguity. Apply coherently to the input quantum state and a clean quantum register; do not measure the eigenvalue label. By linearity it produces .
Append a quantum ancilla in , and use the provided quantum variable rotation with , choosing the nonnegative cosine. The resulting normalized quantum state is
The sum covers both terms; this fixes the potentially ambiguous sum placement in the abbreviated display. The orthonormal basis of eigenvectors and the unit length of each rotated quantum ancilla show that its norm is one. This is quantum spectral filtering by multiplication, not the reciprocal rotation used in the HHL algorithm.
The usual sufficient input promises for the HHL algorithm are efficient quantum state preparation of the nonzero vector , efficient access to a sparse matrix with at most nonzero entries per row, and a condition number after an efficiently known normalization. Both the positions and values of the nonzero matrix elements must be computable coherently in polynomial time. More generally, efficient Hamiltonian simulation can replace the sparsity promise. We assume is invertible; if zero eigenvalues occur, one must instead restrict to their orthogonal complement and specify the desired inverse on that support.
With and a known bound , choose . The HHL controlled reciprocal rotation then succeeds with probability
This is the required inverse-polynomial lower bound. In the usual approximate algorithm, inverse-polynomial requested error also gives polynomial runtime under these input promises. The original HHL paper states the dependence on sparsity, conditioning, and accuracy.
There is a qualification for a literally exact version. Representability of the eigenvalues in bits does not itself make exact quantum phase estimation efficient: using requires controlled powers corresponding to evolution times as large as . Under the paper's idealization we may describe their exact action, but polynomial runtime for that exact circuit additionally requires efficient implementations of those controlled powers, or equivalent efficient exact spectral access. Assuming an operation executes exactly does not bound its cost. This distinction is recorded in cost of exact phase estimation on a dyadic spectrum.
For a positive Hermitian matrix,
The HHL algorithm phase-estimates , performs a controlled rotation with amplitude proportional to , uncomputes the estimate, and postselects the rotation ancilla. Resolving the smallest eigenvalue requires phase-estimation precision and evolution time . Since , this contributes a dependence at least linear in .
The controlled rotation must use a scale . In the worst input direction its success probability is of order
so obtaining constant success by amplitude amplification costs another factor. Thus a runtime polynomial in requires
An exponentially ill-conditioned matrix would require exponentially fine phase resolution or exponentially many amplification steps.
Let the spectral decomposition of the Hermitian matrix be
The HHL algorithm proceeds as follows.
Efficiently prepare the normalized amplitude encoding .
Apply quantum phase estimation to the simulated evolution , producing an approximation of each eigenvalue:
Add one ancilla and perform an eigenvalue-controlled rotation
where .
Uncompute the eigenvalue register. Conditional on measuring the ancilla as , the system register is
The postselection probability can be increased with amplitude amplification.
The ingredients used here are efficient sparse Hamiltonian simulation of and quantum phase estimation, which converts an eigenphase of that evolution into a binary approximation of . For sparsity , condition number , and error , the cost is polynomial in , , , and under the stated access assumptions.
Finally estimate by repeated measurement of an efficient observable decomposition of , or by a Hadamard test when is unitary. A general efficiently block-encoded Hermitian can similarly be measured through its block encoding. Repetition and a concentration inequality give additive sampling error after independent preparations.
The HHL algorithm requires coherent, efficient and repeatable preparation of the normalized state , normally through a known preparation circuit and its inverse; possession of a single unknown physical specimen does not supply that access. The component of on any discarded or unresolved small-eigenvalue subspace must also be negligible. Here is a unitary operator, so it is invertible and all its singular values equal one, giving condition number .
Standard HHL is stated for a Hermitian matrix with an efficient sparse-access or block encoding oracle. A non-Hermitian can be embedded in the Hermitian block matrix
part (a) supplies efficient access to . With inverse-polynomial target precision, phase bits, and an efficient preparation oracle for , the runtime is . The output is the normalized quantum state proportional to the solution , rather than a classical list of all its amplitudes.
For the HHL algorithm to have runtime polynomial in , the Hermitian matrix must be invertible, have a condition number bounded by , and be a sparse matrix with its nonzero entries efficiently accessible by an oracle. The normalized state must also be preparable in time. With precision costs suppressed, these assumptions let HHL prepare, with high probability,
Let a Hermitian operator have dyadic eigenvalues in for known , with controlled access to the unitary operator . This interval ensures that different eigenvalues have different eigenphases; exact representability alone would not exclude phase aliasing, as and both give phase zero. Let a real function obey , and assume the required quantum variable rotations are available. Coherent exact quantum phase estimation, a quantum variable rotation and uncomputation implement
Postselection on flag one gives normalized, with probability , provided this vector is nonzero. Erasing the eigenvalue label by uncomputation is essential to preserve coherence between different eigenvectors. On this dyadic spectrum, gives , so reversing the phase-estimation gates is possible using forward controlled- calls. The choice multiplies by ; a scaled reciprocal gives the different filter used in the HHL algorithm.