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

SparseObservable evolution #13836

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

Conversation

Cryoris
Copy link
Contributor

@Cryoris Cryoris commented Feb 13, 2025

Summary

Add support for SparseObservable in PauliEvolution.

Details and comments

Evolution under projectors is implemented by controlling the target rotation with open controls (for +1 eigenstate projectors) or closed controls (for -1 eigenstate projectors). This is significantly more efficient than decomposing projectors into Paulis, shown here for the implementation of $exp(-i t Z \otimes |1\rangle\langle 1|^{\otimes n})$ for different numbers of projectors $n$.

image (1)

@Cryoris Cryoris added this to the 2.0.0 milestone Feb 13, 2025
@Cryoris Cryoris requested a review from a team as a code owner February 13, 2025 11:25
@qiskit-bot
Copy link
Collaborator

One or more of the following people are relevant to this code:

  • @Cryoris
  • @Qiskit/terra-core
  • @ajavadia

@1ucian0 1ucian0 linked an issue Feb 13, 2025 that may be closed by this pull request
Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

This is really cool, I've only skimmed the PR so far, but I had a couple small nits/comments.

Comment on lines +216 to +217
def _sparse_term_label(term):
return "".join(BIT_LABELS[bit] for bit in reversed(term.bit_terms))
Copy link
Member

Choose a reason for hiding this comment

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

I feel like we should do this in Rust as a pyfunction because it'd be faster and we could use the enum variants for BitTerm directly. Not that it really matters, but it feels more natural in rust.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking of adding a method to SparseTerm, maybe something like bit_labels() or so. But a standalone function would ofc also work

Comment on lines +188 to +191
// .map(|(gate, params, qargs)| {
// (gate.into(), params, qargs.to_vec(), vec![] as Vec<Clbit>)
// })
// .collect::<Vec<Instruction>>();
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// .map(|(gate, params, qargs)| {
// (gate.into(), params, qargs.to_vec(), vec![] as Vec<Clbit>)
// })
// .collect::<Vec<Instruction>>();

@mtreinish mtreinish added the Changelog: New Feature Include in the "Added" section of the changelog label Feb 13, 2025
@Cryoris Cryoris linked an issue Feb 18, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the "Added" section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support SparseObservable in PauliEvolutionGate Add SparseObservable support for PauliEvolutionGate
3 participants