Skip to content

Conversation

@swernli
Copy link
Collaborator

@swernli swernli commented Apr 26, 2023

This change introduces a pass to transform away conjugate expressions by generating the appropriate adjoint blocks. It reuses the code introduced for adjoint generation and adds one extra check regarding use of mutable variables inside the apply-block.

With this change, a conjugate expression like this:

within {
    X(q);
    Z(q);
}
apply {
    X(q);
    Z(q);
}

becomes a block expression:

{
    {
        X(q);
        Z(q);
    }
    {
        X(q);
        Z(q);
    }
    {
        Adjoint Z(q);
        Adjoint X(q);
    }
}

@swernli swernli force-pushed the swernli/conjugate-transform branch 4 times, most recently from 5d40b2f to 3a5c43c Compare April 26, 2023 18:26
Base automatically changed from swernli/logic-sep to main April 26, 2023 18:31
This change introduces a pass to transform away conjugate expressions by generating the appropriate adjoint blocks. It reuses the code introduced for adjoint generation and adds one extra check regarding use of mutable variables inside the apply-block.
@swernli swernli force-pushed the swernli/conjugate-transform branch from 3a5c43c to 10c1485 Compare April 26, 2023 18:35
@swernli swernli marked this pull request as ready for review April 26, 2023 18:36
Copy link
Contributor

@kuzminrobin kuzminrobin left a comment

Choose a reason for hiding this comment

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

Approving to unblock, but I would recommend at least one more approval.

@DmitryVasilevsky
Copy link
Contributor

I rebased Deutsch-Jozsa branch on top of this (locally) and removed all modifications with manual adjoint/within implementation. I can confirm that it works as expected.

@swernli
Copy link
Collaborator Author

swernli commented Apr 27, 2023

Merging as admin in Cesar's absence as co-owner of the libraries and katas.

@swernli swernli merged commit 5180883 into main Apr 27, 2023
@swernli swernli deleted the swernli/conjugate-transform branch April 27, 2023 15:46
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.

7 participants