v923z / micropython-ulab

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

Constructed array using ulab.numpy.ndarray() #301

Open water5 opened 3 years ago

water5 commented 3 years ago

https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html

Refer numpy.ndarray(shape), its parameter is shape, although arrays should be constructed using array(), arange(), zeros() ... and ulab.numpy support 2D array currently, but I think compatible numpy.ndarray() will be a good idea.

Currently: ulab.numpy.ndarray((2, 2)) -> array([2.0, 2.0], dtype=float32)

v923z commented 3 years ago

This is correct, but I don't see at the moment, where the problem is. I am afraid, it might have to do with how micropython is implemented. I will look into this, though.

CallumJHays commented 3 years ago

Ah, looks like I didn't read the spec properly for #280 :sweat_smile: I'll try to get a fix out by tomorrow.

v923z commented 3 years ago

@CallumJHays OK, thanks! I think you are right, one can catch this in the constructor function, or in ndarray_make_new.