-
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
Finalize Rust representation for standard gates #12709
Conversation
// The default ctrl_states are 1, "1" and None. These are the only cases where controlled | ||
// gates can be standard. | ||
let is_default_ctrl_state: bool = match py_op.getattr(py, intern!(py, "ctrl_state")) { | ||
Ok(c_state) => match c_state.extract::<Option<i32>>(py) { | ||
Ok(c_state_int) => match c_state_int { | ||
Some(c_int) => c_int == 1, | ||
None => true, | ||
}, | ||
Err(_) => false, | ||
}, | ||
Err(_) => false, | ||
}; |
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.
CCX's default control state is 3 - did we not include that in the standard gates?
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.
Aha, that makes sense, I wasn't thinking beyond 2q gates. I will generalize the logic.
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.
Pull Request Test Coverage Report for Build 9761907886Warning: 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 |
Pull Request Test Coverage Report for Build 9856279167Details
💛 - Coveralls |
…order. Make definitions and matrices consistent with new gate order. Remove C4XGate (second mcx) from list.
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 LGTM, I personally probably wouldn't have bothered to reorder the match statements for the matrices and definitions because the order doesn't matter so much there. But being consistent with the canonical order makes sense.
* Add missing gate definitions * Reorder gates, following number of qubits and a sort of alphabetical order. Make definitions and matrices consistent with new gate order. Remove C4XGate (second mcx) from list.
Summary
Details and comments
This PR completes #12566 🎉
The proposed gate order is as follows (52 gates in total). Starting 1q gate list from
HGate
as suggested by @alexanderivrii.