-
Notifications
You must be signed in to change notification settings - Fork 62
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
Circuit Execution Outputs #1039
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
📢 Thoughts on this report? Let us know!. |
Okay this should be ready for review now. I am also working on adding a table to the docs to summarize the circuit execution outcomes depending on the settings. |
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.
Thank you for working on this @BrunoLiegiBastonLiegi. The new objects look good and the results are much cleaner now. I wrote some comments below, note that some of them are hidden because they are many. I still need to have a look in the documentation updates and a more detailed look in the test updates.
Other than that, it may be worth updating this with main and fixing the conflicts every now and then because conflicts will block the merge even if we approve. In principle you can fix once when we are ready to merge but is usually better to maintain this up-to-date with main.
Co-authored-by: Stavros Efthymiou <35475381+stavros11@users.noreply.github.com>
Co-authored-by: Stavros Efthymiou <35475381+stavros11@users.noreply.github.com>
Co-authored-by: Stavros Efthymiou <35475381+stavros11@users.noreply.github.com>
Co-authored-by: Stavros Efthymiou <35475381+stavros11@users.noreply.github.com>
Co-authored-by: Stavros Efthymiou <35475381+stavros11@users.noreply.github.com>
Co-authored-by: Stavros Efthymiou <35475381+stavros11@users.noreply.github.com>
Co-authored-by: Stavros Efthymiou <35475381+stavros11@users.noreply.github.com>
@BrunoLiegiBastonLiegi thanks for this. Could you please also consider the possibility to store and load the numpy object that are required in order to reallocate the results classes? This is necessary for the future remote connection mechanism based on http requests. |
Could you please include the qibo version in the results objects and remove the backend from the dump and use numpy as default when loading? |
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 had a quick look at the docs as I have not done this before and it looks good to me. Feel free to merge this and open an issue about the probabilities or anything else we could potentially address in the future.
I will test the qibolab part later and if there is any update required here we can fix in a new PR.
Co-authored-by: Stavros Efthymiou <35475381+stavros11@users.noreply.github.com>
Co-authored-by: Stavros Efthymiou <35475381+stavros11@users.noreply.github.com>
As requested in #1020, three objects are implemented that substitute the old
CircuitResult
object.Depending on the different conditions, now the circuit execution returns:
QuantumState
CircuitResult
density_matrix=False
elseQuantumState
CircuitResult
ifdensity_matrix=True
elseMeasurementOutcomes
where the new
CircuitResult(QuantumState, MeasurementOutcomes)
object contains both theQuantumState
and theMeasurementOutcomes
.nshots
is set by default to1000
now.The probabilities and the state can be recovered as
QuantumState.probabilities()
andQuantumState.state()
, the frequencies and the samples withMeasurementOutcomes.frequencies()
andMeasurementOutcomes.samples()
.CircuitResult
gives access to all of them in the same way.Currently the only case that has been left out is measurements with
collapse=True
.One possibility to handle them could be:
-->
QuantumState
if density_matrix=True--> raise Error if density_matrix=False
-->
CircuitResult
if density_matrix=True-->
MeasurementOutcomes
if density_matrix=FalseFurthermore, handling the
Circuit._final_state
attribute now is a bit problematic, as depending on the conditions different different things are obtained after execution.Checklist: