Code
qcr:2604.71162.1

An enhanced hybrid HHL algorithm

We present a classical enhancement to improve the accuracy of the Hybrid variant (Hybrid HHL) of the quantum algorithm for solving linear systems of equations proposed by Harrow, Hassidim, and Lloyd (HHL). We achieve this by using higher precision quantum estimates of the eigenvalues relevant to the linear system, and a new classical step to guide the eigenvalue inversion part of Hybrid HHL. We show that eigenvalue estimates with just two extra bits of precision result in tighter error bounds for our Enhanced Hybrid HHL compared to HHL. Our enhancement reduces the error of Hybrid HHL by an average of 57 percent on an ideal quantum processor for a representative sample of 2x2 systems. On IBM Torino and IonQ Aria-1 hardware, we see that the error of Enhanced Hybrid HHL is on average 13 percent and 20 percent (respectively) less than that of HHL for the same set of systems.
Linear Algebra
Qubit
Circuit-based
Superconducting qubits
Uploaded 6 months ago
166
Views
Citing this entry? Use this QCR ID
Uploaded by
QL
QCR Librarian

Overview

jackhmorgan/Enhanced-Hybrid-HHL
73
README.md

Enhanced-Hybrid-HHL

This project contains code and example problems used to the Enhanced Hybrid HHL Algorithm [1]. For benchmarking purposes, the project can implement the standard HHL algorithm [2], the Hybrid HHL algorithm [3], as well as the variation of the Hybrid HHL algorithm proposed by [4]. The variant of the HHL class is determined by the choice of inversion circuit and eigenvalue preprocessing parameter.

Example Implementation

Step one: Define a Quantum Linear System Problem

In this example we estimate in the equation where $\mathcal{A} = $ A_matrix and b_vector defined below. We test the accuracy of the algorithm by observing the estimated state with the projection operator onto the ideal solution.

from enhanced_hybrid_hhl import (HHL, 
                                 Lee_preprocessing,  
                                 HybridInversion, 
                                 QuantumLinearSystemProblem, 
                                 QuantumLinearSystemSolver,
                                 EnhancedHybridInversion)
import numpy as np
from qiskit_aer import AerSimulator

# define the backend to run the circuits on
simulator = AerSimulator()

# Define quantum linear system problem to be solved with HHL
a_matrix = np.array([[ 0.5 , -0.25],
        [-0.25,  0.5 ]])
b_vector = np.array([[1.], [0.]])
problem = QuantumLinearSystemProblem(A_matrix=a_matrix,
                                     b_vector=b_vector)
Step two: Choose the algorithm parameters
k = 3 # clock qubits for hhl.
l = k+2 # clock qubits for enhanced preprocessing.
min_prob = 2**-k # hybrid preprocessing relevance threshold.
relevance_threshold = 2**-l # enhanced hybrid preprocessing relevance threshold.
maximum_eigenvalue = 1 # Over estimate of largest eigenvalue in the system.

get_result_type = 'get_swap_test_result'
ideal_x_statevector = QuantumLinearSystemSolver(problem=problem).ideal_x_statevector
Step three: Define Preprocessing and Inversion circuit classes
# In this example, we use the standard QPEA used by Lee et al.
enhanced_preprocessing = Lee_preprocessing(num_eval_qubits=l,
                                  max_eigenvalue= maximum_eigenvalue, 
                                  backend=simulator).estimate

enhanced_eigenvalue_inversion = EnhancedHybridInversion
Step four: Create the HHL Class
enhanced_hybrid_hhl = HHL(get_result_function= get_result_type,
          preprocessing= enhanced_preprocessing,
          eigenvalue_inversion= enhanced_eigenvalue_inversion,
          backend=simulator,
          statevector=ideal_x_statevector)
Step five: Run the algorithm
enhanced_hybrid_hhl_result = enhanced_hybrid_hhl.estimate(problem=problem,
                                                          num_clock_qubits=k,
                                                          max_eigenvalue=1)

print(enhanced_hybrid_hhl_result)
References

[1] Morgan, J., Ghysels, E., & Mohammadbagherpoor, H. (2024). An Enhanced Hybrid HHL Algorithm. arXiv preprint arXiv:2404.10103.

[2] Harrow, A. W., Hassidim, A., & Lloyd, S. (2009). Quantum algorithm for linear systems of equations. Physical review letters, 103(15), 150502.

[3] Lee, Y., Joo, J., & Lee, S. (2019). Hybrid quantum linear equation algorithm and its experimental test on IBM Quantum Experience. Scientific reports, 9(1), 4778.

[4] Yalovetzky, R., Minssen, P., Herman, D., & Pistoia, M. (2021). Hybrid HHL with Dynamic Quantum Circuits on Real Hardware. arXiv preprint arXiv:2110.15958.

License

This project uses Apache 2.0 License

Join the Discussion

Comments (0)

No comments yet. Be the first to share your thoughts!

Indexed by QCR Librarian

This entry was created automatically from publicly available records. QCR links to public sources and only stores repository content where the license permits redistribution.

Publication

doi:10.1016/j.physleta.2024.130181
An enhanced hybrid HHL algorithm

Jack Morgan, Eric Ghysels, Hamed Mohammadbagherpoor

Versions

v1 Latest
Apr 15, 2026
qcr:2604.71162.1

Cite all versions? Use the base QCR ID to always reference the latest version of this entry.

Tools used

Qiskit

Keywords

hhl
linear system of equations

You may also like5