diff --git a/extmod/ulab b/extmod/ulab index 6b9ea24b2e..42d831e1e6 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit 6b9ea24b2e57e200d9e2e0f41f6836b1fd73c348 +Subproject commit 42d831e1e65b1c75ed90de11b87a1c4a0ebe6152 diff --git a/py/py.mk b/py/py.mk index 01fce2447e..5e044947ac 100644 --- a/py/py.mk +++ b/py/py.mk @@ -107,14 +107,15 @@ endif ifeq ($(MICROPY_PY_ULAB),1) SRC_MOD += $(addprefix extmod/ulab/code/, \ -filter.c \ +create.c \ fft.c \ +filter.c \ linalg.c \ ndarray.c \ numerical.c \ poly.c \ -vectorise.c \ ulab.c \ +vectorise.c \ ) CFLAGS_MOD += -DMICROPY_PY_ULAB=1 -DMODULE_ULAB_ENABLED=1 $(BUILD)/extmod/ulab/code/%.o: CFLAGS += -Wno-sign-compare -Wno-missing-prototypes -Wno-unused-parameter -Wno-missing-declarations -Wno-error -Wno-shadow -Wno-maybe-uninitialized -DCIRCUITPY diff --git a/shared-bindings/ulab/__init__.rst b/shared-bindings/ulab/__init__.rst index 7e30f2a10a..b2933be792 100644 --- a/shared-bindings/ulab/__init__.rst +++ b/shared-bindings/ulab/__init__.rst @@ -129,8 +129,6 @@ Array type codes Basic Array defining functions ------------------------------ -See also `ulab.linalg.eye` and `ulab.numerical.linspace` for other useful -array defining functions. .. method:: ones(shape, \*, dtype=float) @@ -158,6 +156,33 @@ array defining functions. Return a new square array of size, with the diagonal elements set to 1 and the other elements set to 0. +.. method:: linspace(start, stop, \*, dtype=float, num=50, endpoint=True) + + .. param: start + + First value in the array + + .. param: stop + + Final value in the array + + .. param int: num + + Count of values in the array + + .. param: dtype + + Type of values in the array + + .. param bool: endpoint + + Whether the ``stop`` value is included. Note that even when + endpoint=True, the exact ``stop`` value may not be included due to the + inaccuracy of floating point arithmetic. + + Return a new 1-D array with ``num`` elements ranging from ``start`` to ``stop`` linearly. + + :mod:`ulab.vector` --- Element-by-element functions =================================================== @@ -288,14 +313,6 @@ much more efficient than expressing the same operation as a Python loop. Computes the eigenvalues and eigenvectors of a square matrix - -.. method:: eye(size, \*, dtype=float) - - :param int: size - The number of rows and columns in the matrix - - Returns a square matrix with all the diagonal elements set to 1 and all - other elements set to 0 - .. method:: inv(m) :param ~ulab.array m: a square matrix @@ -387,32 +404,6 @@ operate over the flattened array (None), rows (0), or columns (1). Returns a new array that reverses the order of the elements along the given axis, or along all axes if axis is None. -.. method:: linspace(start, stop, \*, dtype=float, num=50, endpoint=True) - - .. param: start - - First value in the array - - .. param: stop - - Final value in the array - - .. param int: num - - Count of values in the array - - .. param: dtype - - Type of values in the array - - .. param bool: endpoint - - Whether the ``stop`` value is included. Note that even when - endpoint=True, the exact ``stop`` value may not be included due to the - inaccuracy of floating point arithmetic. - - Return a new 1-D array with ``num`` elements ranging from ``start`` to ``stop`` linearly. - .. method:: max(array, \*, axis=None) Return the maximum element of the 1D array, as an array with 1 element diff --git a/tests/ulab/smoke.py b/tests/ulab/smoke.py index 1cc7fd86db..e6d7f55138 100644 --- a/tests/ulab/smoke.py +++ b/tests/ulab/smoke.py @@ -12,7 +12,7 @@ ulab.array([1,2,3], dtype=ulab.uint16) ulab.array([1,2,3], dtype=ulab.float) ulab.zeros(3) ulab.ones(3) -a = ulab.linalg.eye(3) +a = ulab.eye(3) a.shape a.size a.itemsize @@ -33,7 +33,7 @@ a[0] a[:] a[0] = 0 a[:] = ulab.zeros((3,3)) -a = ulab.linalg.eye(3) +a = ulab.eye(3) ulab.vector.acos(a) ulab.vector.acosh(a) ulab.vector.asin(a) @@ -62,8 +62,8 @@ ulab.linalg.inv(a) ulab.linalg.eig(a) ulab.linalg.det(a) ulab.filter.convolve(ulab.array([1,2,3]), ulab.array([1,10,100,1000])) -ulab.numerical.linspace(0, 10, num=3) -a = ulab.numerical.linspace(0, 10, num=256, endpoint=True) +ulab.linspace(0, 10, num=3) +a = ulab.linspace(0, 10, num=256, endpoint=True) ulab.fft.spectrum(a) p, q = ulab.fft.fft(a) ulab.fft.ifft(p)