-
Notifications
You must be signed in to change notification settings - Fork 606
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
Supporting counts from raw samples #2562
Comments
This change will likely require engineering not just |
This change could include creating a new |
Hello PennyLane team, I submitted PR 2686 that adds this feature. I based my implementation on editing the As for the @antalszava , @Jaybsoni , could you please review the PR? Thanks! |
Closing with #2686 merged. |
Feature details
Given a quantum circuit we can sample the final state it prepares in the computation basis. For example:
Samples produces an array containing the results of sampling the circuit. Its shape is
(num_shots, num_qubits)
in this case it would be(10, 3)
. In general it could be the case that someone asks for a very larger number of shots on a system with many qubits. In this case, it would be difficult to work with this full array of samples.To address this we would like to support the ability to pass in a
counts=True
option toqml.sample
such that the QNode upon evaluation returns a dictionary containing each unique state and the number of times it was sampled.Implementation
How important would you say this feature is?
1: Not important. Would be nice to have.
Additional information
Once the counts are available, we can also return a vector representation of the counts:
In this case the list would have
2^n
elements wheren
is the number of qubits. The element at indexi
would correspond to the number of samples for thei
th basis state.The text was updated successfully, but these errors were encountered: