enhanced-hybrid-hhl

Code for the classical enhancement to the Hybrid HHL Algorithm

https://github.com/jackhmorgan/enhanced-hybrid-hhl

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (6.5%) to scientific vocabulary
Last synced: 10 months ago · JSON representation ·

Repository

Code for the classical enhancement to the Hybrid HHL Algorithm

Basic Info
  • Host: GitHub
  • Owner: jackhmorgan
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Size: 95 MB
Statistics
  • Stars: 4
  • Watchers: 2
  • Forks: 2
  • Open Issues: 0
  • Releases: 0
Created over 2 years ago · Last pushed over 1 year ago
Metadata Files
Readme License Citation

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 $\ket{x}$ in the equation $\mathcal{A} \ket{x} = \ket{b}$ where $\mathcal{A} = $ Amatrix and $\ket{b} =$ bvector defined below. We test the accuracy of the algorithm by observing the estimated state $\ket{x}$ with the projection operator onto the ideal solution.

```python from enhancedhybridhhl import (HHL, Leepreprocessing,
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

amatrix = np.array([[ 0.5 , -0.25], [-0.25, 0.5 ]]) bvector = np.array([[1.], [0.]]) problem = QuantumLinearSystemProblem(Amatrix=amatrix, bvector=bvector) ```

Step two: Choose the algorithm parameters

```python k = 3 # clock qubits for hhl. l = k+2 # clock qubits for enhanced preprocessing. minprob = 2**-k # hybrid preprocessing relevance threshold. relevancethreshold = 2**-l # enhanced hybrid preprocessing relevance threshold. maximum_eigenvalue = 1 # Over estimate of largest eigenvalue in the system.

getresulttype = 'getswaptestresult' idealxstatevector = QuantumLinearSystemSolver(problem=problem).idealx_statevector ```

Step three: Define Preprocessing and Inversion circuit classes

```python

In this example, we use the standard QPEA used by Lee et al.

enhancedpreprocessing = Leepreprocessing(numevalqubits=l, maxeigenvalue= maximumeigenvalue, backend=simulator).estimate

enhancedeigenvalueinversion = EnhancedHybridInversion ```

Step four: Create the HHL Class

python 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

```python enhancedhybridhhlresult = enhancedhybridhhl.estimate(problem=problem, numclockqubits=k, maxeigenvalue=1)

print(enhancedhybridhhl_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

Citation (citation.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Morgan"
  given-names: "Jack"
  orcid: "https://orcid.org/0009-0000-5014-4246"
title: "Enhanced-Hybrid-HHL"
version: 1.0.0
doi: 10.5281/zenodo.1234
date-released: 2024-03-08
url: "https://github.com/jackhmorgan/Enhanced-Hybrid-HHL"

GitHub Events

Total
  • Watch event: 2
  • Fork event: 2
  • Create event: 1
Last Year
  • Watch event: 2
  • Fork event: 2
  • Create event: 1

Dependencies

setup.py pypi