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.
Hi @fedimser, you're initial commits look interesting! I left some initial comments.
Thanks for the review. |
@msoeken, can you please advice which linear algebra library I can use in the C# code? |
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 a lot @fedimser, this is great work! I left some comments, mostly formatting and some suggestions.
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 doing this, we really appreciate your contribution! I've marked as request changes for some of the required modifications (e.g.: copyright headers), but I'm happy to help expand on or implement any of my comments.
Since this PR modifies the Q# API, I'll also go on and schedule it for the next API Review Meeting, and will comment here accordingly following that meeting. Thank you!
Co-authored-by: Chris Granade <cgranade@gmail.com> Co-authored-by: Mathias Soeken <mathias.soeken@gmail.com>
Co-authored-by: Mathias Soeken <mathias.soeken@gmail.com>
Co-authored-by: Chris Granade <cgranade@gmail.com> Co-authored-by: Mathias Soeken <mathias.soeken@gmail.com>
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 great to me, thanks! I left some few comments.
Hi Mathias, I addressed your comments. One more thing to double check is that my algorithm indeed applies matrix to little-endian register. The easiest way to check that is to see what is matrix for CNOT gate, and I have a test for that. |
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.
Just some formatting suggestions.
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.
This looks really good, thanks for the contribution! I've left a few last comments as suggestions that would be good to bring in before merging this to main
, but otherwise I think this is getting pretty close now that the API review has completed.
Thank you again!
@cgranade, I addressed your comments. I think this PR is now ready to be merged. |
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, thank you for the contribution! ♥
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
This PR adds Q# operation which applies arbitrary gate specified by 2^n x 2^n unitary matrix on a qubit register, as requested in #291.
It's based on an algorithm which I have implemented in Python in this repository.
Implementation consists of 3 parts:
Complexity of this algorithm is O(N^3) and size of output is O(N^2), where N is size of matrix (N=2^n, where n is number of qubits).