Skip to content

Conversation

@daxfohl
Copy link
Collaborator

@daxfohl daxfohl commented Apr 8, 2022

Now that there's a default sample method for QuantumStateRepr, I updated a test function to use that instead (by removing the custom implementation that test used previously). The test below started to fail (it returned [[1], [1]] even though all breakpoints showed that the measurement was still [[2], [2]], which was super confusing). I finally tracked it down to the dtype being bool in that default sample method. Changed that to uint8, and now all tests pass using the default sampler. I didn't add any new tests because the changes to the existing test validates it.

def test_run_one_gate_circuit_noise():
sim = CountingSimulator(noise=cirq.X)
r = sim.run(cirq.Circuit(cirq.X(q0), cirq.measure(q0)), repetitions=2)
assert np.allclose(r.measurements['0'], [[2], [2]])

Also piggybacked a small todo from one of my other tests into this PR.

@daxfohl daxfohl requested review from a team, cduck and vtomole as code owners April 8, 2022 18:39
@daxfohl daxfohl requested a review from viathor April 8, 2022 18:39
@CirqBot CirqBot added the size: S 10< lines changed <50 label Apr 8, 2022
@daxfohl
Copy link
Collaborator Author

daxfohl commented Apr 14, 2022

@95-martin-orion small one here if you missed it.

@95-martin-orion 95-martin-orion self-assigned this Apr 14, 2022
@95-martin-orion 95-martin-orion added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Apr 22, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Apr 22, 2022
@CirqBot CirqBot merged commit 9af5538 into quantumlib:master Apr 22, 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 Apr 22, 2022
tonybruguier pushed a commit to tonybruguier/Cirq that referenced this pull request Apr 22, 2022
…#5234)

Now that there's a default sample method for QuantumStateRepr, I updated a test function to use that instead (by removing the custom implementation that test used previously). The test below started to fail (it returned `[[1], [1]]` even though all breakpoints showed that the measurement was still `[[2], [2]]`, which was *super* confusing). I finally tracked it down to the dtype being `bool` in that default `sample` method. Changed that to uint8, and now all tests pass using the default sampler. I didn't add any new tests because the changes to the existing test validates it.

https://github.com/quantumlib/Cirq/blob/1522b024d2613b9acd0a57ca9eafa58371063484/cirq-core/cirq/sim/simulator_base_test.py#L237-L240

Also piggybacked a small todo from one of my other tests into this PR.
@daxfohl daxfohl deleted the fix-qudit-sampler branch April 22, 2022 22:35
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
…#5234)

Now that there's a default sample method for QuantumStateRepr, I updated a test function to use that instead (by removing the custom implementation that test used previously). The test below started to fail (it returned `[[1], [1]]` even though all breakpoints showed that the measurement was still `[[2], [2]]`, which was *super* confusing). I finally tracked it down to the dtype being `bool` in that default `sample` method. Changed that to uint8, and now all tests pass using the default sampler. I didn't add any new tests because the changes to the existing test validates it.

https://github.com/quantumlib/Cirq/blob/1522b024d2613b9acd0a57ca9eafa58371063484/cirq-core/cirq/sim/simulator_base_test.py#L237-L240

Also piggybacked a small todo from one of my other tests into this PR.
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
…#5234)

Now that there's a default sample method for QuantumStateRepr, I updated a test function to use that instead (by removing the custom implementation that test used previously). The test below started to fail (it returned `[[1], [1]]` even though all breakpoints showed that the measurement was still `[[2], [2]]`, which was *super* confusing). I finally tracked it down to the dtype being `bool` in that default `sample` method. Changed that to uint8, and now all tests pass using the default sampler. I didn't add any new tests because the changes to the existing test validates it.

https://github.com/quantumlib/Cirq/blob/1522b024d2613b9acd0a57ca9eafa58371063484/cirq-core/cirq/sim/simulator_base_test.py#L237-L240

Also piggybacked a small todo from one of my other tests into this PR.
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.

3 participants