-
Notifications
You must be signed in to change notification settings - Fork 90
Check qubit release/measurement status on release #796
Conversation
| } | ||
| return reinterpret_cast<Result>( | ||
| m(this->simulatorId, (unsigned)numBases, reinterpret_cast<unsigned*>(bases), ids.data())); | ||
| } |
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.
I have an impression that only one qubit is marked as measured regardless of the number of qubits being measured.
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 classical bit is returned, but that could come from a joint measurement on an arbitrary number of qubits. E.g.: Measure([PauliZ, PauliZ], [q0, q1]) collapses the state of [q0, q1] onto either the +1 or −1 eigenspace of 𝑍 ⊗ 𝑍, spanned by {|00⟩, |11⟩} and {|01⟩, |10⟩}, respectively.
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.
If multiple qubits are measured it doesn't guarantee that the individual qubit state is known. Only when the length of ids is 1 (ie: when only a single qubit is being measured and not a joint measurement) do we want to mark that qubit as measured and safe to release.
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.
Thanks.
cgranade
left a comment
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.
Some of these comments seemed to get stuck in a pending review, sorry. Probably out of date now...
This mimicks the same behavior in the QIR Runtime wrapper for the fullstate simulator as what we have for C#, namely that a qubit is falid for release if and only if it is either in the ground state or the last operation on that qubit was measure.
This fixes #552, and supercedes #710.