Skip to content

Conversation

@pavoljuhas
Copy link
Collaborator

  • 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.

@pavoljuhas pavoljuhas requested review from a team, cduck and vtomole as code owners July 7, 2022 18:40
@pavoljuhas pavoljuhas requested a review from tanujkhattar July 7, 2022 18:40
@CirqBot CirqBot added the size: S 10< lines changed <50 label Jul 7, 2022
@pavoljuhas pavoljuhas linked an issue Jul 7, 2022 that may be closed by this pull request
@pavoljuhas
Copy link
Collaborator Author

Partially implements #3767

Copy link
Collaborator

@dabacon dabacon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question.

prng=np.random.RandomState(),
initial_state=state_vector.copy(),
dtype=state_vector.dtype,
dtype=complex_dtype,
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

Copy link
Collaborator

@dabacon dabacon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

prng=np.random.RandomState(),
initial_state=state_vector.copy(),
dtype=state_vector.dtype,
dtype=complex_dtype,
Copy link
Collaborator

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.

@dabacon dabacon added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jul 7, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jul 7, 2022
@vtomole
Copy link
Collaborator

vtomole commented Jul 7, 2022

check/mypy --next now passes without errors.

@pavoljuhas How so? I see errors on this PR's mypy --next action: https://github.com/quantumlib/Cirq/runs/7240128717?check_suite_focus=true

@CirqBot CirqBot merged commit 1ca3e95 into quantumlib:master Jul 7, 2022
@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Jul 7, 2022
@pavoljuhas pavoljuhas deleted the fix-mypy-numpy-errors-4 branch July 7, 2022 19:39
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
- 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.
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
- 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: S 10< lines changed <50

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants