Skip to content
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

Merged
merged 22 commits into from
Aug 5, 2024
Merged

PauliZGate #254

merged 22 commits into from
Aug 5, 2024

Conversation

mtweiden
Copy link
Contributor

@mtweiden mtweiden commented Jun 28, 2024

New features:

  • A new PauliZMatrices class allows for diagonal Hermitian matrices to be easily specified. Using the PauliMatrices class results in unwanted overparameterization. The API used is very similar to that for PauliMatrices.
  • A new PauliZGate lets n-qubit diagonal unitaries be specified in a Circuit.
  • Support synthesizing diagonal unitaries into quantum circuits [1]. This is facilitated through the WalshDiagonalSynthesisPass. Outputs are always use CNOTGates and RZGates.

[1] https://arxiv.org/abs/1306.3991
[2] https://arxiv.org/abs/2109.03371

@mtweiden mtweiden requested a review from edyounis June 28, 2024 21:01
Copy link
Member

@edyounis edyounis left a 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.

bqskit/utils/math.py Outdated Show resolved Hide resolved

def diagonal_distance(unitary: npt.NDArray[np.complex128]) -> float:
"""
Compute how diagonal a unitary is.
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will be soon!

bqskit/qis/pauliz.py Outdated Show resolved Hide resolved
bqskit/qis/pauliz.py Outdated Show resolved Hide resolved
bqskit/qis/pauliz.py Show resolved Hide resolved
bqskit/passes/synthesis/diagonal.py Outdated Show resolved Hide resolved
bqskit/passes/synthesis/diagonal.py Outdated Show resolved Hide resolved
bqskit/passes/synthesis/diagonal.py Outdated Show resolved Hide resolved
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.
Copy link
Member

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.

bqskit/ir/gates/parameterized/pauliz.py Outdated Show resolved Hide resolved
@edyounis edyounis merged commit fff2f24 into main Aug 5, 2024
17 checks passed
@edyounis edyounis deleted the PauliZGate branch August 5, 2024 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants