-
Notifications
You must be signed in to change notification settings - Fork 1.1k
make final_density_matrix work with classical control #7610
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
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
i appear to have missed handling unused qubits |
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.
looks good so far, just a couple points
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7610 +/- ##
=======================================
Coverage 97.50% 97.50%
=======================================
Files 1103 1103
Lines 99709 99732 +23
=======================================
+ Hits 97222 97246 +24
+ Misses 2487 2486 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
You can use |
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.
lgtm % a couple nits.
there is one more issue that I am not sure how to handle properly: in the case of classical control, if the |
Hmm, so what happens? Does the simulation output tensor include a dimension for the 2nd qubit even though it's not in the circuit? I'd say that sounds like a bug in the simulate method, not a bug here. I think it's fine to leave that case unhandled. If anyone encounters that problem, then we can figure out how they expect it to be handled at that point. |
yes, something like that. It eventually results in a reshapring error |
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.
lgtm cc @pavoljuhas
- access protocol functions from the `protocols` module - eliminate single-use variables - remove unnecessary blank lines
- use np.diag to construct the expected density matrix - remove test of matrix shape; it is already checked in assert_allclose
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.
Fixes #5915
Largely a direct implementation of the idea of @daxfohl in #5915.