-
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
Support repeated measurement keys in cirq.Result #4555
Conversation
d06caa7
to
669bf13
Compare
669bf13
to
e080647
Compare
2614a78
to
fb17c43
Compare
fb17c43
to
f71da9d
Compare
f71da9d
to
234807e
Compare
I've rebased this on master including the separation of |
Let's cover this at our meeting Thursday - there are a bunch of open threads here and I'd like to get them woven together before rushing ahead on this. |
064b8ca
to
faa7446
Compare
faa7446
to
ccab511
Compare
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.
A pretty self-explanatory implementation of Result
as described in the RFC, though there's a comment from @Strilanc there you should take a look at before we commit to this.
cirq-core/cirq/work/zeros_sampler.py
Outdated
prev_n = num_qubits.setdefault(key, n) | ||
if n != prev_n: | ||
raise ValueError( | ||
"Different num qubits for repeated measurement: " |
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.
Two things:
- This also needs to check that the dimensions for each qudit are the same - e.g. (3, 2) != (2, 3).
- This feels like the wrong place for this check to live, since presumably every sampler/simulator is going to require it. Could we move it up to the Sampler superclass?
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.
Moved this into a helper function Sampler._get_measurement_shapes
in the base class. Note that this is basically a preliminary version of the "measurement_key_shape" protocol proposed in #4888.
Approved, but requires conflict resolution before merging. The change looks fairly minor. |
I noticed one surprising (to me anyway) behavior of |
Part of #4274