-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
base: main
Are you sure you want to change the base?
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
// .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>>(); |
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$ .