-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 qk_obs_compose(_map)
#13950
Add qk_obs_compose(_map)
#13950
Conversation
One or more of the following people are relevant to this code:
|
Pull Request Test Coverage Report for Build 13637252625Details
💛 - Coveralls |
Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
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.
Thanks for writing the tests to not rely on the particular factorisation, haha.
edit: this review is mostly just formalising conversations Julien and I had offline, for posterity. They should already be resolved by 5d7a5a9.
crates/cext/src/sparse_observable.rs
Outdated
/// # Safety | ||
/// | ||
/// To call this function safely | ||
/// | ||
/// * ``left`` or ``right`` must be valid, non-null pointers to ``QkObs``\ s | ||
/// * ``qargs`` must point to an array of ``uint32_t``, readable for ``qk_obs_num_qubits(left)`` | ||
/// elements (meaning the number of qubits in ``left``) |
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.
Let's comment that qargs
can be null if left.num_qubits
is 0 (this is useful behaviour for C and C++), and then make sure our own code handles that safely too.
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.
Ace, the changes in the latest commit address everything I'd said (as expected), thanks.
We might have included explicit documentation that qargs
can be null if second.num_qubits
was zero, but in C land that's usually the case, so it's no big deal at all. I'll just merge as-is.
Summary
Adds composition for the C-side
SparseObservable
.Goes on top of #13766.
Details and comments
compose_map
legit?