-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add partial_transpose
to quantum_info.linalg_operations
#1462
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1462 +/- ##
=======================================
Coverage 99.93% 99.93%
=======================================
Files 81 81
Lines 11750 11777 +27
=======================================
+ Hits 11742 11769 +27
Misses 8 8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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 think it might be useful to allow the inputs to both partial_transpose
and partial_trace
(this one in a separate PR though) to be batches of states, similarly to what it is done for vectorization
in #1459. This would make more efficient, for instance, the calculation of the meyer_wallach_entanglement
qibo/src/qibo/quantum_info/entanglement.py
Line 196 in 165b204
def meyer_wallach_entanglement(state, backend=None): |
and similar methods that need to perform these operations on several different states.
Done. |
Co-authored-by: BrunoLiegiBastonLiegi <[email protected]>
@AlejandroSopena @stavros11 this is ready. Could you review it soon since it is blocking #1456 ? Thanks |
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 @renatomello. Generally fine with me, but I have not checked validity so I just trust the test.
It took me some time to understand the supported input shapes and I think we are kind of overcomplicating it by supporting 1-dimensional arrays. To me, since this is a partial trace, it would even be sufficient to stick to 2-dimensional. If someone wants to process a 1-dimensional one, they can still do the outer product before calling this (this way it is also a bit more modular). However, I am not the best candidate user of this, so it's not a strong opinion.
Other than that, I understand you are also supporting a "batch" dimension (N
). There may be a way to generalize this to arbitrary number of batch dimensions ((..., k, k)
), so that you don't even have to distinguish between batch/no batch, but I haven't thought much about whether this can be easily done and maybe it's not very useful in the end.
Co-authored-by: Stavros Efthymiou <[email protected]>
I think it's fine supporting statevectors because it takes an extra step from the users' hands at the price of a handful of lines of code on our side. So the trade-off is worth IMO.
I like the idea, but for the interest of time I prefer to move forward as is because we have some priorities that are more urgent. |
Needs to be merged before #1456
Checklist: