-
Notifications
You must be signed in to change notification settings - Fork 159
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
MPS Implementation p4: Two qubit gates. #372
Conversation
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.
Added a couple of review comments. Sergei is out for a couple of weeks - can a thorough review on this wait until he gets back?
C.noalias() = A * B.transpose(); | ||
memcpy(raw_state + offset, raw_state + end, sizeof(fp_type) * bd * 4); | ||
} | ||
|
||
void ApplyGate2(const std::vector<unsigned>& qs, const fp_type* matrix, | ||
State& state) const { | ||
// TODO: micro-benchmark this function and improve performance. |
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.
Is this TODO resolved? If not, please open an issue for it and reference that issue here.
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.
It is not resolved. Opened issue here: #373
tests/mps_simulator_test.cc
Outdated
}; | ||
sim.ApplyGate({0, 1}, mat.data(), mps); | ||
|
||
float *wf = new float[32]; |
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.
Same comment as the previous PR - a clarifying comment on how these wf
values are generated could be helpful.
For sections with Cirq equivalents, something like this might provide the best comparison:
qsim/tests/simulator_testfixture.h
Line 471 in cae9570
The results are obtained with the following Cirq code: |
(includes an equivalent Cirq code snippet)
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.
Added a link to Cirq code that regenerates the fuzz test as well as diagrams and explanations for the other tests. Was this what you had in mind ?
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.
Yes, thank you!
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 to me. There are a number of formatting issues.
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
Looks like the Windows build encountered an error:
|
Adds the two qubit gate application functionality along with tests. Other changes done in this PR:
using MPS = ....
tousing State = ...
in order to work withApplyGate
ingate_appl.h
.