-
Notifications
You must be signed in to change notification settings - Fork 622
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
[BugFix] - Fix the HilbertSchmidt
template
#6604
Conversation
Hello. You may have forgotten to update the changelog!
|
…o Fix_HilbertSchmidt_Template
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6604 +/- ##
=======================================
Coverage 99.46% 99.46%
=======================================
Files 454 454
Lines 42649 42651 +2
=======================================
+ Hits 42420 42422 +2
Misses 229 229 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
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 @PietropaoloFrisoni, looks good to me.
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 for me. Although I'm still wondering if we can have better test explanation, considering the fatality of this bug I only wish this PR merge ASAP
Sry I have new concern below...
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.
Any way we can test whether or not the template is giving us accurate results? How do we know that the template is doing what it's supposed to be doing?
Given we have the time, I think we should add a test that confirms that we are actually doing what we promise.
I double checked the referenced paper, and realized that there's chance that it's somehow different from the description of the issue that reported this bug: the star sign in the paper is claimed to be the complex conjugate instead of adjoint; this might implies that in the actual implementation, the V* acting on the second half of system is indeed the complex conjugate which should not be reverted in order. Instead, the usage of adjoint might need to be changed to complext conjugate. Ref: This paper, page 7 the paragraph in front of formula (15); Figure 4 on page 8; and the corresponding paragraph in Appendix A on page 20. |
No more time for deeper reading today but I want to add another comment that similar tricks appear somewhere that people convert the original adjoint operations to composition of complex conjugate plus some other convenient operations |
I also double-checked in the paper. I initially took for granted the analysis reported in the description of this issue and on Slack, but now I am no longer sure that this template must be changed. The circuit that the paper is proposing to implement the Hilbert-Schmidt Test is the one reported in Figure 4 of the paper itself (also shown in the PL documentation). For this circuit, the probability to obtain the measurement outcome in which all 2n qubits are in the Looking at the left side, I think we should consider the complex conjugate of the trainable unitary V in the circuit, not the adjoint. That is, we should implement the complex conjugate without changing the order. This is equivalent to taking the adjoint as originally implemented:
I think we got confused at first because of the presence of @albi3ro , @JerryChen97, @soranjh What do you think? BTW, I just noticed we don't even have a test that verifies the correctness of this template (which is not used in any demo). I totally agree about adding at least a couple of tests to verify that it works as expected. |
A test against reliable true value is definitely needed; for a quick validation of this whole workflow I suggest that we can add another test to validate the richochet identity. My gut feeling is we might need to validate whether or not the |
…o Fix_HilbertSchmidt_Template
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 for tracking down what we really needed to do.
Context: The
HilbertSchmidt
andLocalHilbertSchmidt
templates do not work correctly since they compute the adjoint instead of the complex conjugate of some operators, as the algorithm requires. For details, see Section 4.1 of this paperDescription of the Change: We compute the complex conjugate instead of the adjoint.
Benefits: Correct result.
Possible Drawbacks: None that I can think of.
Related GitHub Issues: #6586
Related ShortCut Stories: [sc-78349]