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

Ensure LRE compatibility with all supported frontends #2547

Merged
merged 5 commits into from
Nov 6, 2024

Conversation

natestemen
Copy link
Member

Description

This PR ensures that the core functionality of LRE is compatible with all supported frontends.

fixes #2416

@natestemen natestemen self-assigned this Oct 24, 2024
Copy link

codecov bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.72%. Comparing base (ecfa7dc) to head (97b02dc).
Report is 10 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2547   +/-   ##
=======================================
  Coverage   98.72%   98.72%           
=======================================
  Files          92       92           
  Lines        4161     4167    +6     
=======================================
+ Hits         4108     4114    +6     
  Misses         53       53           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

mitiq/lre/tests/test_layerwise_folding.py Outdated Show resolved Hide resolved
)

assert isinstance(lre_exp_val, float)
assert mock_executor.call_count == 10
Copy link
Contributor

Choose a reason for hiding this comment

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

Unit tests are also good to undersrtand how the logic you are testing works (LRE in this case). Reading this, the immediate question I have is: why 10, how is it calculated? Proposal: add an explicit calculation, e.g. expected_call_count = degree * (degree + fold_multiplier) <-- I made this up, since I genuinely don't know where the 10 comes from.

Copy link
Contributor

Choose a reason for hiding this comment

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

This still pending? It's not a big deal, but it makes me feel that the test expectation was written based on what result we empirically got by running the code, instead of the other way around.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah sorry, I changed this here, but not here! I'll update.

mitiq/interface/conversions.py Show resolved Hide resolved
mitiq/typing.py Outdated Show resolved Hide resolved
mitiq/lre/tests/test_layerwise_folding.py Outdated Show resolved Hide resolved
@natestemen
Copy link
Member Author

I think I've resolved all the comments in c2eb37c. Apologies for not splitting it up into different commits, but everything got intertwined as I started working on it.

@natestemen natestemen requested a review from cosenal October 28, 2024 21:57
Copy link
Contributor

@cosenal cosenal left a comment

Choose a reason for hiding this comment

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

LGTM. Left a reminder about a nit from the first review.

mitiq/typing.py Show resolved Hide resolved
)

assert isinstance(lre_exp_val, float)
assert mock_executor.call_count == 10
Copy link
Contributor

Choose a reason for hiding this comment

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

This still pending? It's not a big deal, but it makes me feel that the test expectation was written based on what result we empirically got by running the code, instead of the other way around.

mitiq/interface/conversions.py Show resolved Hide resolved
@natestemen natestemen merged commit 05c45b2 into main Nov 6, 2024
18 checks passed
@natestemen natestemen deleted the nts-lre-qprogram branch November 6, 2024 19:54
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.

Make LRE compatible with non-cirq circuits
3 participants