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

feat(phirgen): add support for ZERO/ONE nullary ops #180

Merged
merged 1 commit into from
May 28, 2024

Conversation

qartik
Copy link
Member

@qartik qartik commented May 24, 2024

Description

Fixes #178

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog with any user-facing changes

@qartik qartik requested a review from cqc-alec May 24, 2024 21:03
}
assert phir["ops"][10]["condition"] == {
"cop": "==",
"args": [["tk_SCRATCH_BIT", 1], 1], # evals to False
Copy link
Member Author

Choose a reason for hiding this comment

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

@cqc-alec I wanted to double check, is this the correct interpretation of how conditioning with ZERO works?

I saw pytket returning the following commands for above test:

        Comment(c='tk_SCRATCH_BIT[0] = (1)'),
        Comment(c='tk_SCRATCH_BIT[1] = (0)'),
        Comment(c='IF ([tk_SCRATCH_BIT[0]] == 1) THEN H q[0];'),
        Comment(c='IF ([tk_SCRATCH_BIT[1]] == 1) THEN H q[0];'),

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that's correct.

Copy link
Collaborator

@cqc-alec cqc-alec left a comment

Choose a reason for hiding this comment

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

LGTM. Have you checked that the generated PHIR works with PECOS?

}
assert phir["ops"][10]["condition"] == {
"cop": "==",
"args": [["tk_SCRATCH_BIT", 1], 1], # evals to False
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that's correct.

@qartik
Copy link
Member Author

qartik commented May 28, 2024

Have you checked that the generated PHIR works with PECOS?

Not yet, let me try that today.

EDIT: Done, all clear.

@qartik qartik merged commit fc136a1 into main May 28, 2024
6 checks passed
@qartik qartik deleted the 178-add-support-for-nullary-bitwise-ops branch May 28, 2024 12:10
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.

Add support for nullary bitwise ops
2 participants