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

Return a mixture of exact and sampled weights as appropriate #255

Merged
merged 27 commits into from
Jul 10, 2023

Conversation

garrison
Copy link
Member

@garrison garrison commented Jun 15, 2023

Fixes #199

Remaining action items:

  • update docstring
  • rename to generate_qpd_weights
  • add release note
  • do everything I can to make this code more understandable (not sure if this will ever truly be "done", but the code is ready for comments 🙂)
  • update tutorials and "exact weights" how-to guide to be consistent with new method for taking exact weights

@garrison garrison added quantum performance Related to the efficiency with which we are able to gain information from the quantum hardware cutting QPD-based circuit cutting code labels Jun 15, 2023
@coveralls
Copy link

coveralls commented Jun 15, 2023

Pull Request Test Coverage Report for Build 5468581107

  • 136 of 136 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.6%) to 90.524%

Totals Coverage Status
Change from base Build 5381924269: 0.6%
Covered Lines: 2503
Relevant Lines: 2765

💛 - Coveralls

@garrison garrison added the enhancement New feature or request label Jun 20, 2023
@garrison garrison marked this pull request as ready for review June 22, 2023 01:34
@garrison garrison added this to the 0.3.0 milestone Jun 22, 2023
Copy link
Collaborator

@caleb-johnson caleb-johnson left a comment

Choose a reason for hiding this comment

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

Looking great, made a few comments and will come back to this for another pass in a bit.

Generate weights from the joint quasiprobability distribution.

All weights above ``1 / num_samples`` will be returned exactly, while the
remaining weights will be sampled from.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
remaining weights will be sampled from.
remaining weights will be generated by sampling from the low-probability elements of the distribution.

I think something like this is a little more clear. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

I rephrased this in 8830c94.

circuit_knitting/cutting/qpd/qpd.py Show resolved Hide resolved
qpd_bases: The :class:`QPDBasis` objects from which to sample
num_samples: Number of random samples to generate
qpd_bases: The :class:`QPDBasis` objects from which to generate weights
num_samples: Maximum number of weights to generate
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
num_samples: Maximum number of weights to generate
num_samples: Number of times to sample from the quasiprobability distribution

I see what you're getting at here, and it makes sense for the CX/CZ case, but I think the description of this arg is more informative if you make it a bit more general

Copy link
Member Author

Choose a reason for hiding this comment

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

I also rephrased this a bit in 8830c94.

circuit_knitting/cutting/qpd/qpd.py Show resolved Hide resolved
circuit_knitting/cutting/qpd/qpd.py Outdated Show resolved Hide resolved
circuit_knitting/cutting/qpd/qpd.py Show resolved Hide resolved
caleb-johnson
caleb-johnson previously approved these changes Jul 10, 2023
Copy link
Collaborator

@caleb-johnson caleb-johnson left a comment

Choose a reason for hiding this comment

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

Looks great. A couple of pedantic suggestions, but LGTM 👍

@garrison garrison merged commit 6d1ef01 into main Jul 10, 2023
9 checks passed
@garrison garrison deleted the weight-mixture branch July 10, 2023 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cutting QPD-based circuit cutting code enhancement New feature or request quantum performance Related to the efficiency with which we are able to gain information from the quantum hardware
Projects
None yet
3 participants