-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
restrict classical action of certain arithmetic bloqs #1518
base: main
Are you sure you want to change the base?
restrict classical action of certain arithmetic bloqs #1518
Conversation
…sri/Qualtran into fix_classical_action
if x < self.mod and y < self.mod: | ||
y = (x + y) % self.mod | ||
return {'x': x, 'y': y} |
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.
should we instead raise a ValueError
for out-of-bounds inputs? (similar to e.g. BQUInt.assert_valid_classical_val
).
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.
depends on how you define the bloq ... if we want the bloq to be unitary then the classical action is correct and we don't need to raise an error
however constructions assume valid range ... I don't feel strongly towards either ... although I'm a bit leaning towards raising an error to match the construction
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'd prefer that the classical action raises an error. The tensors-from-classical-action function would need to handle this, of course
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.
done
math.fmod
which fails in the case of overflow ... usingsimulation.classical_sim.add_ints
insteadfixes #1515