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.
Update to the normalize and unnormalize functions to allow bit-shift normalization. This scheme is designed to mimic the normalization as implemented in HLS, where instead of dividing by the sum (or max), everything is actually just bit-shifted based on the MSB location of the sum (or max).
Ex:
an array or charges q = [37, 5, 1, 0]
The sum is 43, but instead of normalizing to 43, things are normalized to the MSB of the sum (32)
normalized_q = [37/32, 5/32, 1/32, 0]
Additionally, the normalize function also includes arguments for bits and integer, in order to perform the quantization of the data during the normalize step.
Finally, internal workings of the functions have been updated to use numpy array operations, removing the need for the for loop and numba compilation. This should speed up the normalize function, since numba.jit was not able to compile in nopython mode.
normalize and unnormalize functions have been checked that they agree with the output of the original functions