generated from CQCL/pytemplate
-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix: Emit nested binary expressions for classical ops #224
Merged
qartik
merged 8 commits into
main
from
215-error-simulating-circuit-with-condition-based-on-more-than-two-bits
Sep 11, 2024
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
05a18ce
test: add test for issue 215
qartik a8f56a5
build: require pecos for CI
qartik 9fc484e
docs: provide maintainer email ID
qartik f0ea2e9
chore: update deps
qartik 0d7815c
fix: generate nested multi-bit conditions for pecos support
qartik a64cec7
test: remove dependency on pecos and more granular test
qartik d511345
refactor: raise TypeError on passing less than min_args
qartik b1105c4
refactor: use `min_args` in the error message
qartik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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.
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.
I have a feeling this will error out if
len(args)
is 0 or 1. While these may be rare edge cases it would be good to handle them or at least raise an informative exception.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.
This would make sense, but PECOS does not seem to be able to deal with
"cop": "&"
with fewer than two arguments.Is there a way to add a "True" constant to an expression in PHIR? The AND with a single element
args == [x]
could be implemented as(x == val) & (x == val)
, but in the case ofargs == []
you'd need to be able to output True somehow.Not sure if we'd want to do this, though. Is it OK for pytket-phir to create valid PHIR when the conditions the user inputted would not be accepted by PECOS if done directly? It's true that in this case, the action of AND on 1 and 0 arguments is not ambiguous, but it still makes me uneasy. I'd just throw an exception with informative message.
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.
The function is only called at one place when
len(args)
is not 1, but for generality (and reusability), it's certainly worth doing an edge case check. Implemented and pushed.