In HHL algorithm, how do we implement matrix $A$ (where $A|x\rangle = |b\rangle$) in the circuit?
2 Answers
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:
- Original paper by Harrow, Hasidim and Lloyd: Quantum algorithm for linear systems of equations
- Practical implementation for 2x2 matrix: Quantum circuits for solving linear systems of equations
- 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.
-
$\begingroup$ You seem to be assuming that A is Hermitian. $\endgroup$ Commented Mar 2, 2020 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$ Commented Mar 2, 2020 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$ Commented Mar 2, 2020 at 7:59
-
$\begingroup$ @DaftWullie: I see your point, answer edited accordingly. $\endgroup$ Commented Mar 2, 2020 at 8:41
you can refer to the site for implementing HHL.
-
3$\begingroup$ Hi, and welcome to the Quantum Computing SE! We prefer to avoid link-only answers, since the links may break with time. Can you sum up what is described within this article in a way that answers the question please? $\endgroup$– Tristan Nemoz ♦Commented Jan 2 at 21:09