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

Add ability to set truncation threshold for SparsePauliOp's simplify method #59

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

BryceFuller
Copy link
Contributor

@BryceFuller BryceFuller commented Feb 18, 2025

SparsePauliOp.simplify() has an implicit threshold for truncating small coefficients, the truncation of these coefficients is not tracked by OBP's error budgeting, so these parameters need to be exposed to users as they introduce un-accounted for sources of error.

The solution implemented here is to add the absolute and relative tolerance values atol, rtol, to the OperatorBudget data structure. These values are then passed along to SparsePauliOp.simplify when it gets called.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 13394792748

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 13182974064: 0.0%
Covered Lines: 433
Relevant Lines: 433

💛 - Coveralls

Copy link
Member

@mrossinek mrossinek left a comment

Choose a reason for hiding this comment

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

I agree with the proposal 👍

Can you please do the following:

  • add docstrings to the new attributes of OperatorBudget
  • run the style linter: tox -e style
  • update the expected output of the unittests
  • add a release note describing the new feature

That should fix the CI on all accounts (I think). Ideally, we could also add some unittests to assert that changing atol and rtol actually has an effect on the result, but I am willing to forego that for this PR and address that later as I am confident in the code as is.

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.

3 participants