2
$\begingroup$

In HHL algorithm, how do we implement matrix $A$ (where $A|x\rangle = |b\rangle$) in the circuit?

$\endgroup$
2
$\begingroup$

A Hermitian matrix $A$ is implemented as series of controlled gates $\mathrm{e}^{iAt}$ for some $t$. This gate can be then implementend with controlled $\mathrm{U3}$ gate on IBM Q.

Note that original paper on HHL algorithm (see link below) provides a "trick" how to convert any matrix to Hermitian one and apply HHL algrithm.

For example, for Hermitian matrix $A$, type 2x2, there are two gates with $t=\frac{\pi}{2}$ and $t=\frac{\pi}{4}$ controlled by two different qubits.

Please see these articles for more information how to implement HHL algorithm:

  1. Original paper by Harrow, Hasidim and Lloyd: Quantum algorithm for linear systems of equations
  2. Practical implementation for 2x2 matrix: Quantum circuits for solving linear systems of equations
  3. Another demonstration of practical implementation (pgs. 49-51): Quantum Algorithm Implementations for Beginners

I would recommend the third article for the best understanding how to implement HHL algorithm in practice.

| improve this answer | |
$\endgroup$
  • $\begingroup$ You seem to be assuming that A is Hermitian. $\endgroup$ – DaftWullie Mar 2 at 6:31
  • $\begingroup$ Yes, it is an assumption of original paper by HHL, however, the authors also provided simple "trick" how to convert non-Hermitian matrix to Hermitian one. See first link, pg. 2. $\endgroup$ – Martin Vesely Mar 2 at 7:49
  • $\begingroup$ I know this. My point was that the Hermitian property is not stated in the question. So you probably want to be clear in your answer that that is what your assuming or, better yet, detail how to avoid it. $\endgroup$ – DaftWullie Mar 2 at 7:59
  • $\begingroup$ @DaftWullie: I see your point, answer edited accordingly. $\endgroup$ – Martin Vesely Mar 2 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.