TeamGraphix / graphix

measurement-based quantum computing (MBQC) compiler and simulator
https://graphix.readthedocs.io
Apache License 2.0
60 stars 21 forks source link

vqe example #161

Closed AbdullahKazi500 closed 3 months ago

AbdullahKazi500 commented 4 months ago

Before submitting, please check the following:

Then, please fill in below:

Context (if applicable): This change adds a use case for a Variational Quantum Eigensolver (VQE) using the graphix library, with a focus on measurement-based quantum computing (MBQC) and tensor network simulation. The purpose is to demonstrate how to implement a variational algorithm for quantum machine learning using graphix.

Description of the change: Added a function to create a Hamiltonian for the VQE problem. Added a function to build a parameterized VQE quantum circuit. Created a class MBQCVQE to handle the creation and simulation of the MBQC pattern. Implemented methods to simulate the MBQC pattern using tensor network backend and other backends. Implemented a method to compute the energy expectation value of the Hamiltonian. Added visualization for the MBQC pattern. Provided a full workflow example for using graphix to implement the VQE algorithm

Related issue: FIXES https://github.com/TeamGraphix/graphix/issues/136

also see that checks (github actions) pass. If lint check keeps failing, try installing black==22.8.0 as behavior seems to vary across versions.

AbdullahKazi500 commented 3 months ago

@shinich1 Hi I will address your few remaining comments tomorrow

AbdullahKazi500 commented 3 months ago

@shinich1 I will do the formatting by tomorrow thanks for the review

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 71.72%. Comparing base (2540824) to head (0284fe7).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #161 +/- ## ========================================== - Coverage 71.84% 71.72% -0.12% ========================================== Files 30 30 Lines 5359 5359 ========================================== - Hits 3850 3844 -6 - Misses 1509 1515 +6 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

shinich1 commented 3 months ago

@AbdullahKazi500 could you paste the code to patch-2 branch, and check that CI passes (black & isort)?

AbdullahKazi500 commented 3 months ago

Hi @shinich1 added the file using the format you have asked here File

shinich1 commented 3 months ago

@AbdullahKazi500 Ok, could you:

AbdullahKazi500 commented 3 months ago

@shinich1 I have deleted the test.py and also starred the repo I Don't know much about black and isort but I can try