Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements high-level functions for QSE #1902

Merged
merged 3 commits into from
Jul 21, 2023

Conversation

bubakazouba
Copy link
Contributor

Description

Closes #1812

Adds execute_with_qse, qse_decorator and mitigate_executor to Quantum Subspace Expansion.


License

  • I license this contribution under the terms of the GNU GPL, version 3 and grant Unitary Fund the right to provide additional permissions as described in section 7 of the GNU GPL, version 3.

Before opening the PR, please ensure you have completed the following where appropriate.

@github-actions
Copy link

github-actions bot commented Jul 9, 2023

Binder 👈 Launch a binder notebook on branch bubakazouba/mitiq/master

@codecov
Copy link

codecov bot commented Jul 9, 2023

Codecov Report

Merging #1902 (3409e25) into master (8180b50) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1902      +/-   ##
==========================================
+ Coverage   98.52%   98.53%   +0.01%     
==========================================
  Files          76       77       +1     
  Lines        3520     3545      +25     
==========================================
+ Hits         3468     3493      +25     
  Misses         52       52              
Impacted Files Coverage Δ
mitiq/qse/__init__.py 100.00% <100.00%> (ø)
mitiq/qse/qse.py 100.00% <100.00%> (ø)
mitiq/qse/qse_utils.py 100.00% <100.00%> (ø)

@andreamari andreamari self-requested a review July 10, 2023 13:33
@natestemen natestemen self-requested a review July 12, 2023 04:54
Copy link
Member

@andreamari andreamari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bubakazouba !
The code is very clean and clear. I like how simple the workflow looks like at the high-level (thanks to previously merged utility functions): get pop, get pp, return pop/pp. :-)

My main comment is on testing improvements with respect to unmitigated execution.
All the rest looks great to me!

mitiq/qse/qse.py Outdated Show resolved Hide resolved
mitiq/qse/tests/test_qse.py Outdated Show resolved Hide resolved
@bubakazouba bubakazouba force-pushed the master branch 2 times, most recently from e9569f9 to d1713a3 Compare July 14, 2023 05:56
Copy link
Member

@natestemen natestemen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with Andrea, really nice work making the main function so simple. A few minor comments.

mitiq/qse/qse.py Outdated Show resolved Hide resolved
mitiq/qse/qse.py Outdated Show resolved Hide resolved
mitiq/qse/qse.py Outdated Show resolved Hide resolved
return (
pauli_string_to_expectation_cache[cache_key] * pauli_string.coeff
).real

total_expectation_value_for_observable = 0.0
final_executor: Executor = (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initially i was overriding the variable, but pylint was getting confused by the type of executor in line 66, so I had to change the name.

Copy link
Member

@andreamari andreamari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
Thanks @bubakazouba for all the constant work on this new QSE technique, taking care of its full implementation in Mitiq. Thanks also to your colleges/collaborators for their contributions during the RFC phase.

POST EDITED: I just noticed that functions are not visible in the API-docs. But since this is true for the full QSE module, I created a new issue (#1923) dedicated to this aspect.

@bubakazouba
Copy link
Contributor Author

LGTM! Thanks @bubakazouba for all the constant work on this new QSE technique, taking care of its full implementation in Mitiq. Thanks also to your colleges/collaborators for their contributions during the RFC phase.

POST EDITED: I just noticed that functions are not visible in the API-docs. But since this is true for the full QSE module, I created a new issue (#1923) dedicated to this aspect.

Thank you! I will start working on #1923 then #1924 with the group

@natestemen natestemen merged commit b2d46d1 into unitaryfund:master Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement high-level functions for QSE
3 participants