-
Notifications
You must be signed in to change notification settings - Fork 36
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
PauliZGate #254
PauliZGate #254
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.
Hey this is awesome and adds a good amount of features. Thanks for doing this. Besides the inline comments, a few overall thoughts:
- The Pauli and PauliZ classes have the same API, and I can imagine more like it in the future (qudits), it might be worthwhile to extract a base class there with a defined API.
- It should be pretty easy to plug the PauliZGate into QFAST, maybe we can make an example with that. If you improve the performance of the gate unitary and gradient calculation, I could imagine this would rival other synthesis algorithms out there in both performance and quality. If this is important to your application, happy to have a chat about this.
- Can you write a list with the new features in the PR message. This will help me when writing the changelog for the next update. See Surround filter #257 for an example of what I mean.
|
||
def diagonal_distance(unitary: npt.NDArray[np.complex128]) -> float: | ||
""" | ||
Compute how diagonal a unitary is. |
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 there a reference for this?
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.
There will be soon!
The DiagonalPredicate class returns True if the circuit's unitary can be | ||
approximately inverted by a diagonal unitary. A unitary is approximately | ||
inverted when the Hilbert-Schmidt distance to the identity is less than some | ||
threshold. |
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.
Might want to put a "See Also" section in the documentation.
New features:
PauliZMatrices
class allows for diagonal Hermitian matrices to be easily specified. Using thePauliMatrices
class results in unwanted overparameterization. The API used is very similar to that forPauliMatrices
.PauliZGate
lets n-qubit diagonal unitaries be specified in a Circuit.WalshDiagonalSynthesisPass
. Outputs are always useCNOTGate
s andRZGate
s.[1] https://arxiv.org/abs/1306.3991
[2] https://arxiv.org/abs/2109.03371