-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Synthesis of CZ and Clifford circuits for linear nearest neighbor connectivity #9450
Conversation
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the the following people are requested to review this:
|
Pull Request Test Coverage Report for Build 4252380784
💛 - Coveralls |
This PR is ready for an initial review (mainly of the API). It only misses the release notes. |
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 Shelly! I took a quick look at the code and overall it seems quite solid. My main question was whether we can extend the interface to allow "cz-layer-synthesis-with-reversal" function instead of hard-coding the function name.
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 @ShellyGarion! The PR looks very good. I only had very minor comments at this point.
qiskit/synthesis/__init__.py
Outdated
from .linear import ( | ||
synth_cnot_count_full_pmh, | ||
synth_cnot_depth_line_kms, | ||
synth_cz_depth_line_mr, | ||
) |
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 don't have a strong opinion on this either. Does it make sense that code for CZ synthesis appears under linear
? Or would it be better to put it in the synthesis/cz
subdirectory?
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 the best solution is to have another folder of synthesis/linear_phase
since the cz synthesis is into cx and phase gates, and relies on the theory of phase polynomials. It's similar to graysynth
that should be moved this folder too.
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.
Moving and renaming graysynth
, as well as deprecating https://github.com/Qiskit/qiskit-terra/blob/main/qiskit/transpiler/synthesis/graysynth.py
will be done in a separate PR
releasenotes/notes/clifford_cz_lnn_synthesis-4b0328b581749df5.yaml
Outdated
Show resolved
Hide resolved
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 Shelly, looks very good. I have asked for two tiny-tiny fixes, after that it's good to go.
…nectivity (Qiskit#9450) * add cz synthesis for LNN * basic cz synthesis test * adjust clifford_decompose_layers to cz synthesis for LNN * add a basic test for layered clifford synthesis for LNN * enhance the tests * fix lint, check function name * Add utils needed for LNN tests * add tests for LNN and depth * Add documentation for cz synthesis * fix misprint * add synth_clifford_depth_lnn * updates following review * rename synth_clifford_depth_lnn * update references * remove a util function that is not needed * update docstring * add release notes * replace int(n/2) by n//2 * reduce the number of 1-qubit gates * fix test * refactor and minor changes following review * update docs * update init file following review --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Summary
#9036
Synthesis of a CZ circuit for linear nearest neighbor (LNN) connectivity in 2-qubit depth of 2n+2 using CX and phase gates (S, Sdg or Z). Note that the synthesized circuit reverts the order of the qubits.
This CZ synthesis method allows to synthesize a Clifford circuit for LNN connectivity in 2-qubit depth of 9n+4 (which is still not optimal), by using the layered Clifford synthesis (clifford_decompose_layers.py) and linear_depth_lnn.py for synthesizing the CX layer in depth 5n.
This PR will be followed by another PR based on a paper of Maslov and Yang (https://arxiv.org/abs/2210.16195), that synthesize the CX-CZ layers in depth 5n for LNN connectivity, and hence reduce the depth of a Clifford circuit to 7n-4 for LNN connectivity.
Details and comments
The algorithm is based on the paper of Maslov and Roetteler https://arxiv.org/abs/1705.09176