francof2a / fxpmath

A python library for fractional fixed-point (base 2) arithmetic and binary manipulation with Numpy compatibility.
MIT License
179 stars 21 forks source link

base representation for multidimensional array raised exception #56

Closed ruoting0103 closed 2 years ago

ruoting0103 commented 2 years ago

arr_fxp.bin() for arr_fxp = Fxp(np.array([[1,2]])) raised the following exception:

rval = [ utils.binary_repr(int(val.real), n_word=self.n_word, n_frac=n_frac_dot) + '+' + utils.binary_repr(int(val.imag), n_word=self.n_word, n_frac=n_frac_dot) + 'j' for val in self.val]

TypeError: only size-1 arrays can be converted to Python scalars

francof2a commented 2 years ago

Thanks for the issue. It wasn't take into account multidimensional arrays in those representation methods.

I fixed that in the unreleased 0.4.6 version. So, in the next release it will be solved!

francof2a commented 2 years ago

Issue solved in v0.4.6