diff --git a/extmod/ulab b/extmod/ulab index b64fa6d4c7..2aae646485 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit b64fa6d4c73287edef9ccf09cfd6ec5009f9628b +Subproject commit 2aae6464856e5213e45c72681dbb20c708fb3c6c diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 146c65f3e1..fb4d6991b1 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -929,11 +929,11 @@ msgstr "" msgid "Extended advertisements with scan response not supported." msgstr "" -#: extmod/ulab/code/fft/fft.c +#: extmod/ulab/code/numpy/fft/fft_tools.c msgid "FFT is defined for ndarrays only" msgstr "" -#: extmod/ulab/code/fft/fft.c +#: extmod/ulab/code/numpy/fft/fft_tools.c msgid "FFT is implemented for linear arrays only" msgstr "" @@ -2387,11 +2387,11 @@ msgstr "" msgid "arg is an empty sequence" msgstr "" -#: extmod/ulab/code/numerical/numerical.c +#: extmod/ulab/code/numpy/numerical/numerical.c msgid "argsort argument must be an ndarray" msgstr "" -#: extmod/ulab/code/numerical/numerical.c +#: extmod/ulab/code/numpy/numerical/numerical.c msgid "argsort is not implemented for flattened arrays" msgstr "" @@ -2399,7 +2399,7 @@ msgstr "" msgid "argument has wrong type" msgstr "" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/numpy/linalg/linalg.c msgid "argument must be ndarray" msgstr "" @@ -2412,7 +2412,8 @@ msgstr "" msgid "argument should be a '%q' not a '%q'" msgstr "" -#: extmod/ulab/code/linalg/linalg.c extmod/ulab/code/numerical/numerical.c +#: extmod/ulab/code/numpy/linalg/linalg.c +#: extmod/ulab/code/numpy/numerical/numerical.c msgid "arguments must be ndarrays" msgstr "" @@ -2425,11 +2426,11 @@ msgstr "" msgid "array/bytes required on right side" msgstr "" -#: extmod/ulab/code/numerical/numerical.c +#: extmod/ulab/code/numpy/numerical/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "" -#: extmod/ulab/code/numerical/numerical.c +#: extmod/ulab/code/numpy/numerical/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" msgstr "" @@ -2437,15 +2438,15 @@ msgstr "" msgid "attributes not supported yet" msgstr "" -#: extmod/ulab/code/numerical/numerical.c +#: extmod/ulab/code/numpy/numerical/numerical.c msgid "axis is out of bounds" msgstr "" -#: extmod/ulab/code/numerical/numerical.c +#: extmod/ulab/code/numpy/numerical/numerical.c msgid "axis must be None, or an integer" msgstr "" -#: extmod/ulab/code/numerical/numerical.c +#: extmod/ulab/code/numpy/numerical/numerical.c msgid "axis too long" msgstr "" @@ -2746,19 +2747,19 @@ msgstr "" msgid "conversion to object" msgstr "" -#: extmod/ulab/code/filter/filter.c +#: extmod/ulab/code/numpy/filter/filter.c msgid "convolve arguments must be linear arrays" msgstr "" -#: extmod/ulab/code/filter/filter.c +#: extmod/ulab/code/numpy/filter/filter.c msgid "convolve arguments must be ndarrays" msgstr "" -#: extmod/ulab/code/filter/filter.c +#: extmod/ulab/code/numpy/filter/filter.c msgid "convolve arguments must not be empty" msgstr "" -#: extmod/ulab/code/poly/poly.c +#: extmod/ulab/code/numpy/poly/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2766,15 +2767,15 @@ msgstr "" msgid "couldn't determine SD card version" msgstr "" -#: extmod/ulab/code/numerical/numerical.c +#: extmod/ulab/code/numpy/numerical/numerical.c msgid "cross is defined for 1D arrays of length 3" msgstr "" -#: extmod/ulab/code/approx/approx.c +#: extmod/ulab/code/scipy/optimize/optimize.c msgid "data must be iterable" msgstr "" -#: extmod/ulab/code/approx/approx.c +#: extmod/ulab/code/scipy/optimize/optimize.c msgid "data must be of equal length" msgstr "" @@ -2811,18 +2812,14 @@ msgstr "" msgid "dict update sequence has wrong length" msgstr "" -#: extmod/ulab/code/numerical/numerical.c +#: extmod/ulab/code/numpy/numerical/numerical.c msgid "diff argument must be an ndarray" msgstr "" -#: extmod/ulab/code/numerical/numerical.c +#: extmod/ulab/code/numpy/numerical/numerical.c msgid "differentiation order out of range" msgstr "" -#: extmod/ulab/code/linalg/linalg.c -msgid "dimensions do not match" -msgstr "" - #: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c #: shared-bindings/math/__init__.c msgid "division by zero" @@ -2938,11 +2935,11 @@ msgstr "" msgid "filesystem must provide mount method" msgstr "" -#: extmod/ulab/code/vector/vectorise.c +#: extmod/ulab/code/numpy/vector/vector.c msgid "first argument must be a callable" msgstr "" -#: extmod/ulab/code/approx/approx.c +#: extmod/ulab/code/scipy/optimize/optimize.c msgid "first argument must be a function" msgstr "" @@ -2950,11 +2947,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "first argument must be an iterable" -msgstr "" - -#: extmod/ulab/code/vector/vectorise.c +#: extmod/ulab/code/numpy/vector/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -2966,7 +2959,7 @@ msgstr "" msgid "flattening order must be either 'C', or 'F'" msgstr "" -#: extmod/ulab/code/numerical/numerical.c +#: extmod/ulab/code/numpy/numerical/numerical.c msgid "flip argument must be an ndarray" msgstr "" @@ -2999,7 +2992,7 @@ msgstr "" msgid "function got multiple values for argument '%q'" msgstr "" -#: extmod/ulab/code/approx/approx.c +#: extmod/ulab/code/scipy/optimize/optimize.c msgid "function has the same sign at the ends of interval" msgstr "" @@ -3074,7 +3067,7 @@ msgstr "" msgid "index is out of bounds" msgstr "" -#: extmod/ulab/code/numerical/numerical.c +#: extmod/ulab/code/numpy/numerical/numerical.c #: ports/esp32s2/common-hal/pulseio/PulseIn.c py/obj.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" @@ -3088,7 +3081,7 @@ msgstr "" msgid "indices must be integers, slices, or Boolean lists" msgstr "" -#: extmod/ulab/code/approx/approx.c +#: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "" @@ -3108,7 +3101,7 @@ msgstr "" msgid "input argument must be an integer, a tuple, or a list" msgstr "" -#: extmod/ulab/code/fft/fft.c +#: extmod/ulab/code/numpy/fft/fft_tools.c msgid "input array length must be power of 2" msgstr "" @@ -3116,15 +3109,15 @@ msgstr "" msgid "input arrays are not compatible" msgstr "" -#: extmod/ulab/code/poly/poly.c +#: extmod/ulab/code/numpy/poly/poly.c msgid "input data must be an iterable" msgstr "" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is singular" msgstr "" @@ -3140,23 +3133,23 @@ msgstr "" msgid "input must be an ndarray" msgstr "" -#: extmod/ulab/code/filter/filter.c +#: extmod/ulab/code/scipy/signal/signal.c msgid "input must be one-dimensional" msgstr "" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/numpy/linalg/linalg.c msgid "input must be square matrix" msgstr "" -#: extmod/ulab/code/numerical/numerical.c +#: extmod/ulab/code/numpy/numerical/numerical.c msgid "input must be tuple, list, range, or ndarray" msgstr "" -#: extmod/ulab/code/poly/poly.c +#: extmod/ulab/code/numpy/poly/poly.c msgid "input vectors must be of equal length" msgstr "" -#: extmod/ulab/code/poly/poly.c +#: extmod/ulab/code/numpy/poly/poly.c msgid "inputs are not iterable" msgstr "" @@ -3168,7 +3161,7 @@ msgstr "" msgid "integer required" msgstr "" -#: extmod/ulab/code/approx/approx.c +#: extmod/ulab/code/numpy/approx/approx.c msgid "interp is defined for 1D arrays of equal length" msgstr "" @@ -3257,11 +3250,7 @@ msgstr "" msgid "issubclass() arg 2 must be a class or a tuple of classes" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "iterables are not of the same length" -msgstr "" - -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/numpy/linalg/linalg.c msgid "iterations did not converge" msgstr "" @@ -3329,7 +3318,11 @@ msgstr "" msgid "math domain error" msgstr "" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/numpy/linalg/linalg.c +msgid "matrix dimensions do not match" +msgstr "" + +#: extmod/ulab/code/numpy/linalg/linalg.c msgid "matrix is not positive definite" msgstr "" @@ -3351,15 +3344,15 @@ msgstr "" msgid "maximum recursion depth exceeded" msgstr "" -#: extmod/ulab/code/approx/approx.c +#: extmod/ulab/code/scipy/optimize/optimize.c msgid "maxiter must be > 0" msgstr "" -#: extmod/ulab/code/approx/approx.c +#: extmod/ulab/code/scipy/optimize/optimize.c msgid "maxiter should be > 0" msgstr "" -#: extmod/ulab/code/numerical/numerical.c +#: extmod/ulab/code/numpy/numerical/numerical.c msgid "median argument must be an ndarray" msgstr "" @@ -3380,7 +3373,7 @@ msgstr "" msgid "module not found" msgstr "" -#: extmod/ulab/code/poly/poly.c +#: extmod/ulab/code/numpy/poly/poly.c msgid "more degrees of freedom than data points" msgstr "" @@ -3498,7 +3491,7 @@ msgstr "" msgid "non-zero timeout must be >= interval" msgstr "" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/numpy/linalg/linalg.c msgid "norm is defined for 1D and 2D arrays" msgstr "" @@ -3599,8 +3592,8 @@ msgstr "" msgid "only slices with step=1 (aka None) are supported" msgstr "" -#: extmod/ulab/code/compare/compare.c extmod/ulab/code/ndarray.c -#: extmod/ulab/code/vector/vectorise.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare/compare.c +#: extmod/ulab/code/numpy/vector/vector.c msgid "operands could not be broadcast together" msgstr "" @@ -3608,7 +3601,7 @@ msgstr "" msgid "operation is implemented for 1D Boolean arrays only" msgstr "" -#: extmod/ulab/code/numerical/numerical.c +#: extmod/ulab/code/numpy/numerical/numerical.c msgid "operation is not implemented on ndarrays" msgstr "" @@ -3753,7 +3746,7 @@ msgstr "" msgid "raw f-strings are not implemented" msgstr "" -#: extmod/ulab/code/fft/fft.c +#: extmod/ulab/code/numpy/fft/fft_tools.c msgid "real and imaginary parts must be of equal length" msgstr "" @@ -3788,7 +3781,7 @@ msgstr "" msgid "rgb_pins[%d] is not on the same port as clock" msgstr "" -#: extmod/ulab/code/numerical/numerical.c +#: extmod/ulab/code/numpy/numerical/numerical.c msgid "roll argument must be an ndarray" msgstr "" @@ -3835,7 +3828,7 @@ msgstr "" msgid "single '}' encountered in format string" msgstr "" -#: extmod/ulab/code/linalg/linalg.c +#: extmod/ulab/code/numpy/linalg/linalg.c msgid "size is defined for ndarrays only" msgstr "" @@ -3843,10 +3836,6 @@ msgstr "" msgid "sleep length must be non-negative" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "slice step can't be zero" -msgstr "" - #: py/objslice.c py/sequence.c msgid "slice step cannot be zero" msgstr "" @@ -3859,19 +3848,19 @@ msgstr "" msgid "soft reboot\n" msgstr "" -#: extmod/ulab/code/numerical/numerical.c +#: extmod/ulab/code/numpy/numerical/numerical.c msgid "sort argument must be an ndarray" msgstr "" -#: extmod/ulab/code/filter/filter.c +#: extmod/ulab/code/scipy/signal/signal.c msgid "sos array must be of shape (n_section, 6)" msgstr "" -#: extmod/ulab/code/filter/filter.c +#: extmod/ulab/code/scipy/signal/signal.c msgid "sos[:, 3] should be all ones" msgstr "" -#: extmod/ulab/code/filter/filter.c +#: extmod/ulab/code/scipy/signal/signal.c msgid "sosfilt requires iterable arguments" msgstr "" @@ -3985,7 +3974,7 @@ msgstr "" msgid "too many arguments provided with the given format" msgstr "" -#: extmod/ulab/code/ulab_create.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/ulab_create.c msgid "too many dimensions" msgstr "" @@ -3998,11 +3987,11 @@ msgstr "" msgid "too many values to unpack (expected %d)" msgstr "" -#: extmod/ulab/code/approx/approx.c +#: extmod/ulab/code/numpy/approx/approx.c msgid "trapz is defined for 1D arrays" msgstr "" -#: extmod/ulab/code/approx/approx.c +#: extmod/ulab/code/numpy/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" msgstr "" @@ -4144,6 +4133,10 @@ msgstr "" msgid "value_count must be > 0" msgstr "" +#: extmod/ulab/code/numpy/linalg/linalg.c +msgid "vectors must have same lengths" +msgstr "" + #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "wakeup conflict" msgstr "" @@ -4173,7 +4166,7 @@ msgstr "" msgid "window must be <= interval" msgstr "" -#: extmod/ulab/code/numerical/numerical.c +#: extmod/ulab/code/numpy/numerical/numerical.c msgid "wrong axis index" msgstr "" @@ -4181,7 +4174,7 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/vector/vectorise.c +#: extmod/ulab/code/numpy/vector/vector.c msgid "wrong input type" msgstr "" @@ -4197,7 +4190,7 @@ msgstr "" msgid "wrong operand type" msgstr "" -#: extmod/ulab/code/vector/vectorise.c +#: extmod/ulab/code/numpy/vector/vector.c msgid "wrong output type" msgstr "" @@ -4221,14 +4214,14 @@ msgstr "" msgid "zero step" msgstr "" -#: extmod/ulab/code/filter/filter.c +#: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "" -#: extmod/ulab/code/filter/filter.c +#: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be of float type" msgstr "" -#: extmod/ulab/code/filter/filter.c +#: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be of shape (n_section, 2)" msgstr "" diff --git a/py/py.mk b/py/py.mk index 3f94aa67a0..ae12e1976d 100644 --- a/py/py.mk +++ b/py/py.mk @@ -106,9 +106,9 @@ $(BUILD)/extmod/modbtree.o: CFLAGS += $(BTREE_DEFS) endif ifeq ($(CIRCUITPY_ULAB),1) -SRC_MOD += $(patsubst $(TOP)/%,%,$(wildcard $(TOP)/extmod/ulab/code/*.c)) -SRC_MOD += $(patsubst $(TOP)/%,%,$(wildcard $(TOP)/extmod/ulab/code/*/*.c)) -CFLAGS_MOD += -DCIRCUITPY_ULAB=1 -DMODULE_ULAB_ENABLED=1 +ULAB_SRCS := $(shell find $(TOP)/extmod/ulab/code -type f -name "*.c") +SRC_MOD += $(patsubst $(TOP)/%,%,$(ULAB_SRCS)) +CFLAGS_MOD += -DCIRCUITPY_ULAB=1 -DMODULE_ULAB_ENABLED=1 -iquote $(TOP)/extmod/ulab/code $(BUILD)/extmod/ulab/code/%.o: CFLAGS += -Wno-missing-declarations -Wno-missing-prototypes -Wno-unused-parameter -Wno-float-equal -Wno-sign-compare -Wno-cast-align -Wno-shadow -DCIRCUITPY endif diff --git a/shared-bindings/_typing/__init__.pyi b/shared-bindings/_typing/__init__.pyi index cc4a0a4391..9a6e963ea5 100644 --- a/shared-bindings/_typing/__init__.pyi +++ b/shared-bindings/_typing/__init__.pyi @@ -13,7 +13,7 @@ import rgbmatrix import ulab ReadableBuffer = Union[ - bytes, bytearray, memoryview, array.array, ulab.array, rgbmatrix.RGBMatrix + bytes, bytearray, memoryview, array.array, ulab.ndarray, rgbmatrix.RGBMatrix ] """Classes that implement the readable buffer protocol @@ -21,19 +21,19 @@ ReadableBuffer = Union[ - `bytearray` - `memoryview` - `array.array` - - `ulab.array` + - `ulab.ndarray` - `rgbmatrix.RGBMatrix` """ WriteableBuffer = Union[ - bytearray, memoryview, array.array, ulab.array, rgbmatrix.RGBMatrix + bytearray, memoryview, array.array, ulab.ndarray, rgbmatrix.RGBMatrix ] """Classes that implement the writeable buffer protocol - `bytearray` - `memoryview` - `array.array` - - `ulab.array` + - `ulab.ndarray` - `rgbmatrix.RGBMatrix` """ diff --git a/shared-bindings/displayio/Bitmap.c b/shared-bindings/displayio/Bitmap.c index ebe2946091..3b2a836eb9 100644 --- a/shared-bindings/displayio/Bitmap.c +++ b/shared-bindings/displayio/Bitmap.c @@ -43,7 +43,7 @@ //| per row is a multiple of 4, then the resulting memoryview will correspond directly with the bitmap's contents. Otherwise, //| the bitmap data is packed into the memoryview with unspecified padding. //| -//| A read-only buffer can be used e.g., with `ulab.frombuffer` to efficiently create an array with the same content as a Bitmap; +//| A read-only buffer can be used e.g., with ``ulab.numpy.frombuffer`` to efficiently create an array with the same content as a Bitmap; //| to move data efficiently from ulab back into a Bitmap, use `bitmaptools.arrayblit`. //| """ //| diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index 0188fa0b60..e71bae9f59 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -164,7 +164,7 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_ //| "RGB565" means that it is organized as a series of 16-bit numbers //| where the highest 5 bits are interpreted as red, the next 6 as //| green, and the final 5 as blue. The object can be any buffer, but -//| `array.array` and `ulab.array` objects are most often useful. +//| `array.array` and ``ulab.ndarray`` objects are most often useful. //| To update the content, modify the framebuffer and call refresh. //| //| If a framebuffer is not passed in, one is allocated and initialized