-
Notifications
You must be signed in to change notification settings - Fork 2.5k
SparseObservable
evolution
#13836
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
Conversation
One or more of the following people are relevant to this code:
|
There was a problem hiding this 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.
def _sparse_term_label(term): | ||
return "".join(BIT_LABELS[bit] for bit in reversed(term.bit_terms)) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a SparseTerm.bit_labels()
method in 4881b5f that allows to get the labels Rust side. They're then ordered in the same fashion as SparseTerm.indices
// .map(|(gate, params, qargs)| { | ||
// (gate.into(), params, qargs.to_vec(), vec![] as Vec<Clbit>) | ||
// }) | ||
// .collect::<Vec<Instruction>>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// .map(|(gate, params, qargs)| { | |
// (gate.into(), params, qargs.to_vec(), vec![] as Vec<Clbit>) | |
// }) | |
// .collect::<Vec<Instruction>>(); |
Pull Request Test Coverage Report for Build 13659671616Warning: 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
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a really cool PR indeed! I have left a few minor questions and comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. very nice improvement!
Perhaps you can add some more tests in the spirit of the graphs presented in the PR, showing that you get the same result, and providing some bounds on the CX cost or depth.
but anyway it's a great PR!
- more comments - more tests
LGTM on my side. |
Summary
Add support for
SparseObservable
inPauliEvolution
.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$ .