1
$\begingroup$

I am following this HHL tutorial to solve the $Ax=b$ problem and have been using the general (inefficient) approach with the BasicAer simulator that they describe in section 4a. I would now like to run on the actual IBMQ machines but I am finding that my circuit depth and CNOT counts are quite high. To solve this issue, I would like to optimize my circuit. In section 4b of the tutorial they outline a method of optimizing their specific problem which substantially reduces the qubit count, circuit depth, and CNOT count. The problem I am having is figuring out how to extend this to larger matrices $A$ than the $2$x$2$ that they use. Is there a general approach to optimizing an HHL circuit?

$\endgroup$
2
$\begingroup$

There isn't any specific method to optimise HHL other than using the PassManager from Qiskit, but this is a more general circuit optimisation. With the newest devices it might be possible to run larger circuits due to the reduced error, otherwise you will have to manually find circuit reductions.

In the last page of https://arxiv.org/abs/2009.04484 you can find the circuits for the example mentioned in the textbook and for the case of a $4\times 4$ matrix, maybe this helps to run your circuit.

$\endgroup$
3
  • $\begingroup$ Additionally, I do not understand why qiskit's HHL general algorithm is not already optimized. For example in the tutorial that I linked in the original question, they provide a general algorithm and then an optimized one. It seems to me that the general algorithm is not useful since it creates a circuit with very large depth and too many CNOT gates. Is the inefficiency of the general HHL algorithm entirely due to the number of ancillary qubits required for the QPE? Are there other factors which contribute to the inefficiency? $\endgroup$ – thespaceman Sep 21 '20 at 21:28
  • 1
    $\begingroup$ The optimisation from the notebook is very specific to the problem and was necessary because of the limited capacities of the hardware. HHL itself is quite optimal, there are some improvements in the literature but in general it is not trivial how to implement these because they use black-box calls, which is not supported in qiskit. $\endgroup$ – user96233 Sep 22 '20 at 15:18
  • 1
    $\begingroup$ The inefficiencies then come from the different parts of the algorithm - state preparation, hamiltonian simulation,... and from the qiskit point of view the biggest inefficiency which will not be overcome for general systems in the short term is hamiltonian simulation (within QPE), and this is because the black box assumptions made in the literature that treats how to simulate general sparse matrices. $\endgroup$ – user96233 Sep 22 '20 at 15:20

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.