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

Relax restriction on classical inputs for modular addition to fix nightly CI #1537

Merged
merged 4 commits into from
Feb 5, 2025

Conversation

NoureldinYosri
Copy link
Contributor

@NoureldinYosri NoureldinYosri commented Feb 3, 2025

The constructions still work when at most one of their inputs ==mod. While this looks like a hack, this is necessarly since many higher level construction assume this since x == mod can appear in lower level bloqs when the input to higher level bloq is x=0

fixes the nightly CI & fixes #1525

@@ -87,13 +87,15 @@ def signature(self) -> 'Signature':
def on_classical_vals(
self, x: 'ClassicalValT', y: 'ClassicalValT'
) -> Dict[str, 'ClassicalValT']:
if not (0 <= x < self.mod):
# The construction still works when at most one of inputs equals `mod`.
special_case = (x == self.mod) ^ (y == self.mod)
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we use or instead of ^

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is at most not at least ... although I can simply say not (x == y == self.mod) and update the inequalities below from x < mod to x <= mod, what do you prefer?

Copy link
Collaborator

@mpharrigan mpharrigan left a comment

Choose a reason for hiding this comment

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

Thanks for investigating and fixing! One nit, then lgtm

@mpharrigan
Copy link
Collaborator

but please wait until tomorrow to merge to see if I can receive notifications of failed nightly workflows.

@NoureldinYosri NoureldinYosri enabled auto-merge (squash) February 5, 2025 20:37
@NoureldinYosri NoureldinYosri merged commit 65b35a0 into quantumlib:main Feb 5, 2025
8 checks passed
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.

Nightly tests are failing
2 participants