-
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
Fix registering global_phase
parameters when creating CircuitData
#13538
Conversation
One or more of the following people are relevant to this code:
|
@@ -1528,16 +1539,18 @@ impl CircuitData { | |||
/// * capacity - The capacity for instructions to use in the output `CircuitData` | |||
/// If `None` the length of `other` will be used, if `Some` the integer | |||
/// value will be used as the capacity. | |||
pub fn clone_empty_like(other: &Self, capacity: Option<usize>) -> Self { | |||
CircuitData { | |||
pub fn clone_empty_like(py: Python, other: &Self, capacity: Option<usize>) -> PyResult<Self> { |
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 change is necessary since CircuitData::set_global_phase
requires the Python
token. This function is so far only ever used in pauli_twirl_2q_gates
, so it is a very non-intrusive change.
Pull Request Test Coverage Report for Build 12200862552Details
💛 - 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.
LGTM, thanks for fixing this!
Summary
Fix a series of bugs caused by not correctly registering the parameters in the
CircuitData
s parameter table upon creation. This led to theQuantumCircuit.global_phase
attribute not being assigned upon callingassign_parameters
. Fixes #13534.Details and comments
I checked for all constructors that take in a
global_phase
and tried to add tests for each (e.g.pauli_twirl_2q_gates
invokesclone_empty_like
).