✨ Add Hadamard Lifting#1605
Draft
LiRem101 wants to merge 71 commits intomunich-quantum-toolkit:mainfrom
Draft
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Signed-off-by: Daniel Haag <121057143+denialhaag@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces the optimization pass Hadamard lifting.
The optimization pass lifts Hadamard gates in front of Pauli gates in order to improve the results bu measurement-lifting. The implemented liftings are:
zfollowed byhtohfollowed byx.xfollowed byhtohfollowed byz.yfollowed byhtohfollowed byy.The transformation are also applied on controlled gates, provided both participating gates have the same target qubit and the same control qubits.
An exception is the
zgate: The transformation exchanges the target and control qubits of a controlled z gate, if it is followed by a controlled Hadamard gate it can be swapped with afterwards.Additionally, a transformation routine is implemented which swaps the target and control qubits of a CNOT operation (by adding four Hadamard gates before/after the target/control qubits). This is applied if a Hadamard gate is applied to the CNOT target, and afterwards the qubit is measured. The whole transformation routine is:

After the transformation routine, measurement-lifting can be used to lift the measurement in front of the control and to remove a costly two-qubit gate.
The paper in which the routine is published is currently under review.
Microsoft Copilot has been occasionally used to draft first versions of code, but was not integrated into an IDE.
Fixes #1386
Checklist
If PR contains AI-assisted content:
Assisted-by: [Model Name] via [Tool Name]footer.