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

Refactor classical_sim.py bitwise functions to allow for signed values #606

Closed
fpapa250 opened this issue Jan 27, 2024 · 2 comments · Fixed by #1215
Closed

Refactor classical_sim.py bitwise functions to allow for signed values #606

fpapa250 opened this issue Jan 27, 2024 · 2 comments · Fixed by #1215

Comments

@fpapa250
Copy link
Contributor

bits_to_ints() and ints_to_bits() only work for conversions of unsigned integers. This limits the classical simulation correctness for bloqs using Join() because its on_classical_vals() implementation uses these functions. Therefore when we get the classical simulation of a bloq that uses Join() it cannot represent signed integers so we can't have tests for classical simulation of signed integer representations.

Currently this affects the signed implementation of Add() and doesn't allow us to classically simulate SimpleAddConstant(). Once this functionality has been changed we need to add tests for the classical simulation of the signed version of SimpleAddConstant().

@fdmalone
Copy link
Collaborator

fdmalone commented Feb 1, 2024

in general I think we want a type_to_bits and bits_to_type method which will appropriately dispatch based on the type of the register. For fixed point we can probably write a little python implementation to define operations given some limited precision. #446

@fpapa250
Copy link
Contributor Author

fpapa250 commented Feb 4, 2024

For tracking purposes: Also an issue for comparison of negative integers in the GreaterThan() bloq.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants