Skip to content
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

Consistency around multiple measurements to the same key in the same Moment #6907

Closed
daxfohl opened this issue Jan 1, 2025 · 0 comments
Closed
Labels
kind/design-issue A conversation around design

Comments

@daxfohl
Copy link
Collaborator

daxfohl commented Jan 1, 2025

I remember this coming up before, and I believe it was decided to allow this, and that's why Moment has a field that preserves op insertion order.

A probably minor residual problem is that this allowance is inconsistent with circuit creation, alignment, transformers, and such. These all assume that ops that overlap on measurement keys must go into different moments.

This caused a subtle bug in align_right, which reverses the moments, calls align_left, and then reverses again. But if two measurements on the same key are in the same moment, then align_left will put them in different moments, and when the circuit is reversed again, those two ops will have swapped in order. #6899 fixes it by swapping order of ops within the moments too, BUT, any call to align_left (and thus to align_right too) will still split the measurements into separate moments, which maybe is different from what the user intended.

Just about all calls to transformers will do the same. Is this okay? Or should we be consistent here? How do we infer user intent? Should append and insert and all the transformers have a flag as to whether measurements and/or controls on the same key can share Moments? Should the circuit have that as a member variable? Or is the ROI to explicitly handle this too low?

@daxfohl daxfohl added the kind/design-issue A conversation around design label Jan 1, 2025
@daxfohl daxfohl changed the title Consistency around multiple measurements on a key in the same Moment Consistency around multiple measurements to the same key in the same Moment Jan 1, 2025
@daxfohl daxfohl closed this as not planned Won't fix, can't repro, duplicate, stale Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/design-issue A conversation around design
Projects
None yet
Development

No branches or pull requests

1 participant