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 utility for dealing with multiple SparsePauliOps #587

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

garrison
Copy link
Member

@garrison garrison commented May 11, 2024

Remaining action items

  • bikeshed the module and function names
  • Sphinx docstrings
  • create guide for how to do a cutting workflow given multiple operators
  • add how-to guide to list in how-tos/README.rst
  • release note

@garrison garrison added the enhancement New feature or request label May 11, 2024
@garrison garrison added this to the 0.8.0 milestone May 11, 2024
@coveralls
Copy link

coveralls commented May 11, 2024

Pull Request Test Coverage Report for Build 9290402313

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 44 of 44 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 9225895876: 0.0%
Covered Lines: 2433
Relevant Lines: 2433

💛 - Coveralls



def gather_unique_observable_terms(
observables: PauliList | Sequence[Pauli | SparsePauliOp],
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 should swap the order here so PauliList gets secondary billing.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I didn't know that the order mattered. Could you clarify what you mean here?

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 was talking about the type hints. The order does not have any impact other than how things are presented in the API docs. Since Sequence[Pauli | SparsePauliOp] is the typical way users will use this function, I want that type to appear first in the documentation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay, I now understand what you meant.

garrison added a commit that referenced this pull request Jul 18, 2024
The previous code passed `observables_nophase` to the cutting code,
so it wasn't even testing the phases through the workflow.  The
correct way to handle such observables with nontrivial phase is to
use the utility introduced in #587.
garrison added a commit that referenced this pull request Jul 19, 2024
* Migrate to `EstimatorV2` in tests

Partially addresses #506.

* black

* Replace `observables` with `observables_nophase`

The previous code passed `observables_nophase` to the cutting code,
so it wasn't even testing the phases through the workflow.  The
correct way to handle such observables with nontrivial phase is to
use the utility introduced in #587.
@garrison garrison modified the milestones: 0.9.0, 0.10.0 Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants