v923z / micropython-ulab

a numpy-like fast vector module for micropython, circuitpython, and their derivatives
https://micropython-ulab.readthedocs.io/en/latest
MIT License
416 stars 114 forks source link

Fix (u)int8 upcasting as per docs and numpy #650

Closed s-ol closed 9 months ago

s-ol commented 10 months ago

Close #649.

For testing with CircuitPython, see the branch https://github.com/s-ol/micropython-ulab/tree/fix-int8-upcasting.

Apologies if this breaks any tests that should have been updated, I couldn't get the test build to work on my system.

v923z commented 10 months ago

The upcasting rules are given here: https://github.com/v923z/micropython-ulab/blob/4bde4efa9de1d002013c57805417aaef4da95740/code/ndarray_operators.c#L32, and here https://github.com/v923z/micropython-ulab/blob/master/docs/manual/source/ulab-ndarray.rst#upcasting

v923z commented 10 months ago

I think this is OK now, thanks! Could you, please, increment the sub-minor version here https://github.com/v923z/micropython-ulab/blob/4bde4efa9de1d002013c57805417aaef4da95740/code/ulab.c#L36, and add an entry here https://github.com/v923z/micropython-ulab/blob/master/docs/ulab-change-log.md? You'll also have to fix the test https://github.com/v923z/micropython-ulab/actions/runs/7153101407/job/19492990488?pr=650, but I think that's just a single line in https://github.com/v923z/micropython-ulab/blob/master/tests/2d/numpy/operators.py.exp, here https://github.com/v923z/micropython-ulab/blob/4bde4efa9de1d002013c57805417aaef4da95740/tests/2d/numpy/operators.py.exp#L97.

v923z commented 9 months ago

OK, thanks!