Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Conversation

@swernli
Copy link
Collaborator

@swernli swernli commented Aug 13, 2021

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.

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.
}
return reinterpret_cast<Result>(
m(this->simulatorId, (unsigned)numBases, reinterpret_cast<unsigned*>(bases), ids.data()));
}
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Collaborator Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks.

Copy link
Contributor

@cgranade cgranade left a 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...

@swernli swernli merged commit ec491fe into main Aug 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QIR simulator should check result of qubit Release

4 participants