-
Notifications
You must be signed in to change notification settings - Fork 51
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
Add vectorized from_bits
and to_bits
#1199
Merged
anurudhp
merged 8 commits into
quantumlib:main
from
anurudhp:2024/07/24-vectorized-bit-conversions
Jul 27, 2024
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c2381f3
Add `from_bits_array`, `to_bits_array`
anurudhp 7ec416d
use `QUInt.from_bits` in `bits_to_ints`
anurudhp d66d980
simplify test parameters
anurudhp 8da1476
use default for bitsize > 64
anurudhp 1d36e3e
fix test
anurudhp af834c6
use `.to_bits` in `ints_to_bits`
anurudhp 8669b09
mypy
anurudhp 25e31c8
Merge branch 'main' into 2024/07/24-vectorized-bit-conversions
anurudhp 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
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
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
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
Oops, something went wrong.
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.
Add a link to an open issue with the TODO?
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'm planning to remove the
fxpmath
dependency in classical sim for now, in a follow-up PR, so this might become irrelevant. I can perhaps open an issue later when we decide to actually use fxpmath as our floating point library.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.
You want to remove all code that uses
fxpmath
and remove theQFxp
type ? That seems aggressive.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.
No no, the
QFxp
type will stay, but will use integer values (i.e. binary repr of the fxp) for the classical simulator (i.e. from_bits and to_bits), instead ofFxp
.And other uses of
fxpmath
in the code will not be touched, e.g. the current phase gradientscaled_val
etc.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.
So when calling
bloq.call_classically(phase_grad=_fxp_value_)
; the_fxp_value_
would be an int I believe ?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.
Yep, like it is right now. I'll add a helper method to
QFxp
to convert a float/Fxp value into the correct int value for passing to the classical sim, so that end users don't have to manually figure out the correct binary representation.