3
$\begingroup$

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

$\endgroup$

2 Answers 2

5
$\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.

$\endgroup$
4
  • $\begingroup$ You seem to be assuming that A is Hermitian. $\endgroup$
    – DaftWullie
    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$ 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$
    – DaftWullie
    Mar 2, 2020 at 7:59
  • $\begingroup$ @DaftWullie: I see your point, answer edited accordingly. $\endgroup$ Mar 2, 2020 at 8:41
0
$\begingroup$

you can refer to the site for implementing HHL.

https://quantumpedia.uk/quantum-algorithm-4-hhl-algorithm-for-linear-systems-of-equations-40619daec41d

$\endgroup$
1
  • 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
    Jan 2 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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