fxpmath
fxpmath copied to clipboard
A python library for fractional fixed-point (base 2) arithmetic and binary manipulation with Numpy compatibility.
Hi, I'm trying to use fixed point to simulate the FFT and generate the golden pattern for hardware design. I set my input signal to be 'fxp-s32/23', and to avoid...
I've been trying to export my weights from a neural network to binary using bin function but i noticed that the representation is in ones complement. Although, in the definition...
The following code results in an unexpected behavior. At least for me. ``` x = Fxp( np.array([1.25, 0.5]), dtype='S8.4' ) y = Fxp( np.array([2.25, 1.5]), dtype='S8.4' ) x[0].equal(y[0]) print(x[0]) ```...
bitwise operation of a complex number only applies to real component and yields a non-complex integer, take `x = Fxp(0b11+0b11*1j, dtype = 'fxp-u2/0-complex')` as an example , `x&0b01` outputs `fxp-u2/0((1+0j))`...
I'm wondering if there is a way to revert calling `.bin()`. Something like: ```python x1 = Fxp(3.4) x_bin = x1.bin() x2 = from_bin(x_bin) assert x1 == x2 ``` My use...
Should we expect *all* numpy functions to work with fxpmath, or just the common ones? I'm trying to call `numpy.linalg._umath_linalg.eigh_lo` and getting the following exception: ``` File "{{site-packages}}fxpmath/objects.py", line 1577,...
Consider this code snippet: ```python a = Fxp(-2., dtype="fxp-s24/8") b = Fxp(2.15, dtype="fxp-s24/8") assert b.status['inaccuracy'] c = a+b # This fails: assert c.status['inaccuracy'] ``` It might make sense for the...
## What This PR Achieves After reviewing the fxpmath source, I saw that there was no current implementation for the 'Keep' shifting configuration, despite it being a valid option when...
***tl;dr*** `mypy` reports error when reviewing a file with `import fxpmath`: `error: Skipping analyzing "fxpmath": module is installed, but missing library stubs or py.typed marker [import-untyped]` ## Problem Running _mypy_...
When performing multiplications using complex `Fxp` numbers, the result `dtype` is not inferred correctly. This can lead to overflow in the resulting value. Example: ```py from fxpmath import Fxp x...