-
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
constructing cliffords from linear functions and permutation gates #10423
constructing cliffords from linear functions and permutation gates #10423
Conversation
One or more of the the following people are requested to review this:
|
Pull Request Test Coverage Report for Build 5846291654
💛 - Coveralls |
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 PR is well-written and will be a good contribution to Qiskit.
I only have a minor comment, in this PR it is worth to update the test from PR #10053:
https://github.com/Qiskit/qiskit-terra/blob/06416d7ee75500c50cfddc67574421cf73913f8a/test/python/circuit/library/test_linear_function.py#L489
(I checked the code and it should work now)
Thanks @ShellyGarion, good catch! I have updated the test in 7cb3a4f. |
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. TBH, I'm a little concerned about the cyclic import, but that's due to the original design.
…iskit#10423) * constructing cliffords from linear functions and permutation gates * updating test
Summary
Adding
Clifford.from_linear_function
andClifford.from_permutation
methods, and allowing to construct a Clifford either directly from a linear function or a permutation, or from a quantum circuit containing such gates.Details and comments
Previously, Cliffords could be constructed from linear functions (or from circuits containing linear functions), however this required to first synthesize each linear function into a circuit consisting of CX and SWAP gates and then to create a Clifford from this circuit. This is obviously slower than the direct construction: when a linear function is represented by a nxn binary invertible matrix
A
, then the corresponding Clifford has the symplectic matrix[[A^{t}, 0], [0, A^{-1}]]
.Just for fun, here are some numbers showing the times for the old and the new constructions, summed over 10 different linear functions with the right number of qubits:
Both are very fast when the number of qubits is in the small-medium range, but after that the time to synthesize a linear function becomes noticeable.
Previously, Cliffords could not be constructed from permutation gates (i.e. from
PermutationGate
objects), though they could be constructed from Permutation circuits, which again required to synthesize them first. Again, a direct and much easier construction is available (not to mention that permutations are special cases of linear functions).