-
Notifications
You must be signed in to change notification settings - Fork 1k
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 remaining mypy/numpy errors #5677
Conversation
Also drop redundant assignment to _ in the test. The apply_measurement method has no return value.
Partially implements #3767 |
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.
One question.
args = state_vector_simulation_state.StateVectorSimulationState( | ||
available_buffer=np.empty_like(state_vector), | ||
qubits=qubits, | ||
prng=np.random.RandomState(), | ||
initial_state=state_vector.copy(), | ||
dtype=state_vector.dtype, | ||
dtype=complex_dtype, |
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.
in this case, since this is in the simulation direct call path, should we just do a cast here?
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.
Are we sure state_vector.dtype
is complex?
If so we can make it simpler with cast.
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.
Oh I misread where this is, this is in the testing of consistent act_on. Think this is fine. Not sure we can assume state_vector dtype is complex, so this works.
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
args = state_vector_simulation_state.StateVectorSimulationState( | ||
available_buffer=np.empty_like(state_vector), | ||
qubits=qubits, | ||
prng=np.random.RandomState(), | ||
initial_state=state_vector.copy(), | ||
dtype=state_vector.dtype, | ||
dtype=complex_dtype, |
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.
Oh I misread where this is, this is in the testing of consistent act_on. Think this is fine. Not sure we can assume state_vector dtype is complex, so this works.
@pavoljuhas How so? I see errors on this PR's |
- Fix type mismatch in _BufferedStateVector.create argument - Fix type of the measurements argument to CliffordState.apply_measurement - Fix type spec of the dtype argument to StateVectorSimulationState `check/mypy --next` now passes without errors.
- Fix type mismatch in _BufferedStateVector.create argument - Fix type of the measurements argument to CliffordState.apply_measurement - Fix type spec of the dtype argument to StateVectorSimulationState `check/mypy --next` now passes without errors.
check/mypy --next
now passes without errors.