From e51f7447d2fcfee6ba4e0a0b9e46cb7815eaef57 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 1 Apr 2021 14:57:02 -0500 Subject: [PATCH 1/2] code: Add a docstring for numpy, scipy packages .. this fixes a problem in CircuitPython where building the docs would say "../shared-bindings/ulab/numpy/approx/index.rst: WARNING: document isn't included in any toctree" --- code/numpy/numpy.c | 3 +++ code/scipy/scipy.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/code/numpy/numpy.c b/code/numpy/numpy.c index a6b59a40..63761e92 100644 --- a/code/numpy/numpy.c +++ b/code/numpy/numpy.c @@ -27,6 +27,9 @@ #include "poly/poly.h" #include "vector/vector.h" +//| """Compatibility layer for numpy""" +//| + // math constants #if ULAB_NUMPY_HAS_E mp_obj_float_t ulab_const_float_e_obj = {{&mp_type_float}, MP_E}; diff --git a/code/scipy/scipy.c b/code/scipy/scipy.c index d0e32b54..8faee23a 100644 --- a/code/scipy/scipy.c +++ b/code/scipy/scipy.c @@ -22,6 +22,9 @@ #if ULAB_HAS_SCIPY +//| """Compatibility layer for scipy""" +//| + static const mp_rom_map_elem_t ulab_scipy_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_scipy) }, #if ULAB_SCIPY_HAS_OPTIMIZE_MODULE From 2aae6464856e5213e45c72681dbb20c708fb3c6c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 1 Apr 2021 15:43:09 -0500 Subject: [PATCH 2/2] ulab.array -> ulab.ndarray This was flagged as an error in building circuitpython, since ulab.array doesn't name a type object. --- code/numpy/approx/approx.c | 20 +++++------ code/numpy/fft/fft.c | 12 +++---- code/numpy/linalg/linalg.c | 26 +++++++------- code/numpy/numerical/numerical.c | 16 ++++----- code/numpy/vector/vector.c | 58 ++++++++++++++++---------------- code/scipy/signal/signal.c | 4 +-- code/ulab_create.c | 20 +++++------ 7 files changed, 78 insertions(+), 78 deletions(-) diff --git a/code/numpy/approx/approx.c b/code/numpy/approx/approx.c index 171e0f4f..78d6c697 100644 --- a/code/numpy/approx/approx.c +++ b/code/numpy/approx/approx.c @@ -28,17 +28,17 @@ const mp_obj_float_t approx_trapz_dx = {{&mp_type_float}, MICROPY_FLOAT_CONST(1. #if ULAB_NUMPY_HAS_INTERP //| def interp( -//| x: ulab.array, -//| xp: ulab.array, -//| fp: ulab.array, +//| x: ulab.ndarray, +//| xp: ulab.ndarray, +//| fp: ulab.ndarray, //| *, //| left: Optional[float] = None, //| right: Optional[float] = None -//| ) -> ulab.array: +//| ) -> ulab.ndarray: //| """ -//| :param ulab.array x: The x-coordinates at which to evaluate the interpolated values. -//| :param ulab.array xp: The x-coordinates of the data points, must be increasing -//| :param ulab.array fp: The y-coordinates of the data points, same length as xp +//| :param ulab.ndarray x: The x-coordinates at which to evaluate the interpolated values. +//| :param ulab.ndarray xp: The x-coordinates of the data points, must be increasing +//| :param ulab.ndarray fp: The y-coordinates of the data points, same length as xp //| :param left: Value to return for ``x < xp[0]``, default is ``fp[0]``. //| :param right: Value to return for ``x > xp[-1]``, default is ``fp[-1]``. //| @@ -137,10 +137,10 @@ MP_DEFINE_CONST_FUN_OBJ_KW(approx_interp_obj, 2, approx_interp); #endif #if ULAB_NUMPY_HAS_TRAPZ -//| def trapz(y: ulab.array, x: Optional[ulab.array] = None, dx: float = 1.0) -> float: +//| def trapz(y: ulab.ndarray, x: Optional[ulab.ndarray] = None, dx: float = 1.0) -> float: //| """ -//| :param 1D ulab.array y: the values of the dependent variable -//| :param 1D ulab.array x: optional, the coordinates of the independent variable. Defaults to uniformly spaced values. +//| :param 1D ulab.ndarray y: the values of the dependent variable +//| :param 1D ulab.ndarray x: optional, the coordinates of the independent variable. Defaults to uniformly spaced values. //| :param float dx: the spacing between sample points, if x=None //| //| Returns the integral of y(x) using the trapezoidal rule. diff --git a/code/numpy/fft/fft.c b/code/numpy/fft/fft.c index 7dfe651e..b27e8dcf 100644 --- a/code/numpy/fft/fft.c +++ b/code/numpy/fft/fft.c @@ -26,10 +26,10 @@ //| -//| def fft(r: ulab.array, c: Optional[ulab.array] = None) -> Tuple[ulab.array, ulab.array]: +//| def fft(r: ulab.ndarray, c: Optional[ulab.ndarray] = None) -> Tuple[ulab.ndarray, ulab.ndarray]: //| """ -//| :param ulab.array r: A 1-dimension array of values whose size is a power of 2 -//| :param ulab.array c: An optional 1-dimension array of values whose size is a power of 2, giving the complex part of the value +//| :param ulab.ndarray r: A 1-dimension array of values whose size is a power of 2 +//| :param ulab.ndarray c: An optional 1-dimension array of values whose size is a power of 2, giving the complex part of the value //| :return tuple (r, c): The real and complex parts of the FFT //| //| Perform a Fast Fourier Transform from the time domain into the frequency domain @@ -48,10 +48,10 @@ static mp_obj_t fft_fft(size_t n_args, const mp_obj_t *args) { MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(fft_fft_obj, 1, 2, fft_fft); -//| def ifft(r: ulab.array, c: Optional[ulab.array] = None) -> Tuple[ulab.array, ulab.array]: +//| def ifft(r: ulab.ndarray, c: Optional[ulab.ndarray] = None) -> Tuple[ulab.ndarray, ulab.ndarray]: //| """ -//| :param ulab.array r: A 1-dimension array of values whose size is a power of 2 -//| :param ulab.array c: An optional 1-dimension array of values whose size is a power of 2, giving the complex part of the value +//| :param ulab.ndarray r: A 1-dimension array of values whose size is a power of 2 +//| :param ulab.ndarray c: An optional 1-dimension array of values whose size is a power of 2, giving the complex part of the value //| :return tuple (r, c): The real and complex parts of the inverse FFT //| //| Perform an Inverse Fast Fourier Transform from the frequeny domain into the time domain""" diff --git a/code/numpy/linalg/linalg.c b/code/numpy/linalg/linalg.c index 51b39960..0538e97e 100644 --- a/code/numpy/linalg/linalg.c +++ b/code/numpy/linalg/linalg.c @@ -44,10 +44,10 @@ static ndarray_obj_t *linalg_object_is_square(mp_obj_t obj) { #endif #if ULAB_MAX_DIMS > 1 -//| def cholesky(A: ulab.array) -> ulab.array: +//| def cholesky(A: ulab.ndarray) -> ulab.ndarray: //| """ -//| :param ~ulab.array A: a positive definite, symmetric square matrix -//| :return ~ulab.array L: a square root matrix in the lower triangular form +//| :param ~ulab.ndarray A: a positive definite, symmetric square matrix +//| :return ~ulab.ndarray L: a square root matrix in the lower triangular form //| :raises ValueError: If the input does not fulfill the necessary conditions //| //| The returned matrix satisfies the equation m=LL*""" @@ -111,7 +111,7 @@ static mp_obj_t linalg_cholesky(mp_obj_t oin) { MP_DEFINE_CONST_FUN_OBJ_1(linalg_cholesky_obj, linalg_cholesky); -//| def det(m: ulab.array) -> float: +//| def det(m: ulab.ndarray) -> float: //| """ //| :param: m, a square matrix //| :return float: The determinant of the matrix @@ -182,10 +182,10 @@ MP_DEFINE_CONST_FUN_OBJ_1(linalg_det_obj, linalg_det); #endif -//| def dot(m1: ulab.array, m2: ulab.array) -> Union[ulab.array, float]: +//| def dot(m1: ulab.ndarray, m2: ulab.ndarray) -> Union[ulab.ndarray, float]: //| """ -//| :param ~ulab.array m1: a matrix, or a vector -//| :param ~ulab.array m2: a matrix, or a vector +//| :param ~ulab.ndarray m1: a matrix, or a vector +//| :param ~ulab.ndarray m2: a matrix, or a vector //| //| Computes the product of two matrices, or two vectors. In the letter case, the inner product is returned.""" //| ... @@ -247,7 +247,7 @@ static mp_obj_t linalg_dot(mp_obj_t _m1, mp_obj_t _m2) { MP_DEFINE_CONST_FUN_OBJ_2(linalg_dot_obj, linalg_dot); #if ULAB_MAX_DIMS > 1 -//| def eig(m: ulab.array) -> Tuple[ulab.array, ulab.array]: +//| def eig(m: ulab.ndarray) -> Tuple[ulab.ndarray, ulab.ndarray]: //| """ //| :param m: a square matrix //| :return tuple (eigenvectors, eigenvalues): @@ -308,9 +308,9 @@ static mp_obj_t linalg_eig(mp_obj_t oin) { MP_DEFINE_CONST_FUN_OBJ_1(linalg_eig_obj, linalg_eig); -//| def inv(m: ulab.array) -> ulab.array: +//| def inv(m: ulab.ndarray) -> ulab.ndarray: //| """ -//| :param ~ulab.array m: a square matrix +//| :param ~ulab.ndarray m: a square matrix //| :return: The inverse of the matrix, if it exists //| :raises ValueError: if the matrix is not invertible //| @@ -346,9 +346,9 @@ static mp_obj_t linalg_inv(mp_obj_t o_in) { MP_DEFINE_CONST_FUN_OBJ_1(linalg_inv_obj, linalg_inv); #endif -//| def norm(x: ulab.array) -> float: +//| def norm(x: ulab.ndarray) -> float: //| """ -//| :param ~ulab.array x: a vector or a matrix +//| :param ~ulab.ndarray x: a vector or a matrix //| //| Computes the 2-norm of a vector or a matrix, i.e., ``sqrt(sum(x*x))``, however, without the RAM overhead.""" //| ... @@ -388,7 +388,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(linalg_norm_obj, linalg_norm); #if ULAB_MAX_DIMS > 1 #if ULAB_LINALG_HAS_TRACE -//| def trace(m: ulab.array) -> float: +//| def trace(m: ulab.ndarray) -> float: //| """ //| :param m: a square matrix //| diff --git a/code/numpy/numerical/numerical.c b/code/numpy/numerical/numerical.c index 85255ade..34bd5547 100644 --- a/code/numpy/numerical/numerical.c +++ b/code/numpy/numerical/numerical.c @@ -518,7 +518,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(numerical_argmin_obj, 1, numerical_argmin); #endif #if ULAB_NUMPY_HAS_ARGSORT -//| def argsort(array: ulab.array, *, axis: int = -1) -> ulab.array: +//| def argsort(array: ulab.ndarray, *, axis: int = -1) -> ulab.ndarray: //| """Returns an array which gives indices into the input array from least to greatest.""" //| ... //| @@ -627,7 +627,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(numerical_argsort_obj, 1, numerical_argsort); #endif #if ULAB_NUMPY_HAS_CROSS -//| def cross(a: ulab.array, b: ulab.array) -> ulab.array: +//| def cross(a: ulab.ndarray, b: ulab.ndarray) -> ulab.ndarray: //| """Return the cross product of two vectors of length 3""" //| ... //| @@ -705,7 +705,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(numerical_cross_obj, numerical_cross); #endif /* ULAB_NUMERICAL_HAS_CROSS */ #if ULAB_NUMPY_HAS_DIFF -//| def diff(array: ulab.array, *, n: int = 1, axis: int = -1) -> ulab.array: +//| def diff(array: ulab.ndarray, *, n: int = 1, axis: int = -1) -> ulab.ndarray: //| """Return the numerical derivative of successive elements of the array, as //| an array. axis=None is not supported.""" //| ... @@ -786,7 +786,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(numerical_diff_obj, 1, numerical_diff); #endif #if ULAB_NUMPY_HAS_FLIP -//| def flip(array: ulab.array, *, axis: Optional[int] = None) -> ulab.array: +//| def flip(array: ulab.ndarray, *, axis: Optional[int] = None) -> ulab.ndarray: //| """Returns a new array that reverses the order of the elements along the //| given axis, or along all axes if axis is None.""" //| ... @@ -860,7 +860,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(numerical_mean_obj, 1, numerical_mean); #endif #if ULAB_NUMPY_HAS_MEDIAN -//| def median(array: ulab.array, *, axis: int = -1) -> ulab.array: +//| def median(array: ulab.ndarray, *, axis: int = -1) -> ulab.ndarray: //| """Find the median value in an array along the given axis, or along all axes if axis is None.""" //| ... //| @@ -968,7 +968,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(numerical_min_obj, 1, numerical_min); #endif #if ULAB_NUMPY_HAS_ROLL -//| def roll(array: ulab.array, distance: int, *, axis: Optional[int] = None) -> None: +//| def roll(array: ulab.ndarray, distance: int, *, axis: Optional[int] = None) -> None: //| """Shift the content of a vector by the positions given as the second //| argument. If the ``axis`` keyword is supplied, the shift is applied to //| the given axis. The array is modified in place.""" @@ -1133,7 +1133,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(numerical_roll_obj, 2, numerical_roll); #endif #if ULAB_NUMPY_HAS_SORT -//| def sort(array: ulab.array, *, axis: int = -1) -> ulab.array: +//| def sort(array: ulab.ndarray, *, axis: int = -1) -> ulab.ndarray: //| """Sort the array along the given axis, or along all axes if axis is None. //| The array is modified in place.""" //| ... @@ -1209,7 +1209,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(numerical_std_obj, 1, numerical_std); #endif #if ULAB_NUMPY_HAS_SUM -//| def sum(array: _ArrayLike, *, axis: Optional[int] = None) -> Union[float, int, ulab.array]: +//| def sum(array: _ArrayLike, *, axis: Optional[int] = None) -> Union[float, int, ulab.ndarray]: //| """Return the sum of the array, as a number if axis is None, otherwise as an array.""" //| ... //| diff --git a/code/numpy/vector/vector.c b/code/numpy/vector/vector.c index a92edcca..8246d685 100644 --- a/code/numpy/vector/vector.c +++ b/code/numpy/vector/vector.c @@ -119,7 +119,7 @@ static mp_obj_t vectorise_generic_vector(mp_obj_t o_in, mp_float_t (*f)(mp_float } #if ULAB_NUMPY_HAS_ACOS -//| def acos(a: _ArrayLike) -> ulab.array: +//| def acos(a: _ArrayLike) -> ulab.ndarray: //| """Computes the inverse cosine function""" //| ... //| @@ -129,7 +129,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_acos_obj, vectorise_acos); #endif #if ULAB_NUMPY_HAS_ACOSH -//| def acosh(a: _ArrayLike) -> ulab.array: +//| def acosh(a: _ArrayLike) -> ulab.ndarray: //| """Computes the inverse hyperbolic cosine function""" //| ... //| @@ -139,7 +139,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_acosh_obj, vectorise_acosh); #endif #if ULAB_NUMPY_HAS_ASIN -//| def asin(a: _ArrayLike) -> ulab.array: +//| def asin(a: _ArrayLike) -> ulab.ndarray: //| """Computes the inverse sine function""" //| ... //| @@ -149,7 +149,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_asin_obj, vectorise_asin); #endif #if ULAB_NUMPY_HAS_ASINH -//| def asinh(a: _ArrayLike) -> ulab.array: +//| def asinh(a: _ArrayLike) -> ulab.ndarray: //| """Computes the inverse hyperbolic sine function""" //| ... //| @@ -159,7 +159,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_asinh_obj, vectorise_asinh); #endif #if ULAB_NUMPY_HAS_AROUND -//| def around(a: _ArrayLike, *, decimals: int = 0) -> ulab.array: +//| def around(a: _ArrayLike, *, decimals: int = 0) -> ulab.ndarray: //| """Returns a new float array in which each element is rounded to //| ``decimals`` places.""" //| ... @@ -229,7 +229,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(vectorise_around_obj, 1, vectorise_around); #endif #if ULAB_NUMPY_HAS_ATAN -//| def atan(a: _ArrayLike) -> ulab.array: +//| def atan(a: _ArrayLike) -> ulab.ndarray: //| """Computes the inverse tangent function; the return values are in the //| range [-pi/2,pi/2].""" //| ... @@ -240,7 +240,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_atan_obj, vectorise_atan); #endif #if ULAB_NUMPY_HAS_ARCTAN2 -//| def arctan2(ya: _ArrayLike, xa: _ArrayLike) -> ulab.array: +//| def arctan2(ya: _ArrayLike, xa: _ArrayLike) -> ulab.ndarray: //| """Computes the inverse tangent function of y/x; the return values are in //| the range [-pi, pi].""" //| ... @@ -323,7 +323,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(vectorise_arctan2_obj, vectorise_arctan2); #endif /* ULAB_VECTORISE_HAS_ARCTAN2 */ #if ULAB_NUMPY_HAS_ATANH -//| def atanh(a: _ArrayLike) -> ulab.array: +//| def atanh(a: _ArrayLike) -> ulab.ndarray: //| """Computes the inverse hyperbolic tangent function""" //| ... //| @@ -333,7 +333,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_atanh_obj, vectorise_atanh); #endif #if ULAB_NUMPY_HAS_CEIL -//| def ceil(a: _ArrayLike) -> ulab.array: +//| def ceil(a: _ArrayLike) -> ulab.ndarray: //| """Rounds numbers up to the next whole number""" //| ... //| @@ -343,7 +343,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_ceil_obj, vectorise_ceil); #endif #if ULAB_NUMPY_HAS_COS -//| def cos(a: _ArrayLike) -> ulab.array: +//| def cos(a: _ArrayLike) -> ulab.ndarray: //| """Computes the cosine function""" //| ... //| @@ -353,7 +353,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_cos_obj, vectorise_cos); #endif #if ULAB_NUMPY_HAS_COSH -//| def cosh(a: _ArrayLike) -> ulab.array: +//| def cosh(a: _ArrayLike) -> ulab.ndarray: //| """Computes the hyperbolic cosine function""" //| ... //| @@ -363,7 +363,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_cosh_obj, vectorise_cosh); #endif #if ULAB_NUMPY_HAS_DEGREES -//| def degrees(a: _ArrayLike) -> ulab.array: +//| def degrees(a: _ArrayLike) -> ulab.ndarray: //| """Converts angles from radians to degrees""" //| ... //| @@ -380,7 +380,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_degrees_obj, vectorise_degrees); #endif #if ULAB_SCIPY_SPECIAL_HAS_ERF -//| def erf(a: _ArrayLike) -> ulab.array: +//| def erf(a: _ArrayLike) -> ulab.ndarray: //| """Computes the error function, which has applications in statistics""" //| ... //| @@ -390,7 +390,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_erf_obj, vectorise_erf); #endif #if ULAB_SCIPY_SPECIAL_HAS_ERFC -//| def erfc(a: _ArrayLike) -> ulab.array: +//| def erfc(a: _ArrayLike) -> ulab.ndarray: //| """Computes the complementary error function, which has applications in statistics""" //| ... //| @@ -400,7 +400,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_erfc_obj, vectorise_erfc); #endif #if ULAB_NUMPY_HAS_EXP -//| def exp(a: _ArrayLike) -> ulab.array: +//| def exp(a: _ArrayLike) -> ulab.ndarray: //| """Computes the exponent function.""" //| ... //| @@ -410,7 +410,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_exp_obj, vectorise_exp); #endif #if ULAB_NUMPY_HAS_EXPM1 -//| def expm1(a: _ArrayLike) -> ulab.array: +//| def expm1(a: _ArrayLike) -> ulab.ndarray: //| """Computes $e^x-1$. In certain applications, using this function preserves numeric accuracy better than the `exp` function.""" //| ... //| @@ -420,7 +420,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_expm1_obj, vectorise_expm1); #endif #if ULAB_NUMPY_HAS_FLOOR -//| def floor(a: _ArrayLike) -> ulab.array: +//| def floor(a: _ArrayLike) -> ulab.ndarray: //| """Rounds numbers up to the next whole number""" //| ... //| @@ -430,7 +430,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_floor_obj, vectorise_floor); #endif #if ULAB_SCIPY_SPECIAL_HAS_GAMMA -//| def gamma(a: _ArrayLike) -> ulab.array: +//| def gamma(a: _ArrayLike) -> ulab.ndarray: //| """Computes the gamma function""" //| ... //| @@ -440,7 +440,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_gamma_obj, vectorise_gamma); #endif #if ULAB_SCIPY_SPECIAL_HAS_GAMMALN -//| def lgamma(a: _ArrayLike) -> ulab.array: +//| def lgamma(a: _ArrayLike) -> ulab.ndarray: //| """Computes the natural log of the gamma function""" //| ... //| @@ -450,7 +450,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_lgamma_obj, vectorise_lgamma); #endif #if ULAB_NUMPY_HAS_LOG -//| def log(a: _ArrayLike) -> ulab.array: +//| def log(a: _ArrayLike) -> ulab.ndarray: //| """Computes the natural log""" //| ... //| @@ -460,7 +460,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_log_obj, vectorise_log); #endif #if ULAB_NUMPY_HAS_LOG10 -//| def log10(a: _ArrayLike) -> ulab.array: +//| def log10(a: _ArrayLike) -> ulab.ndarray: //| """Computes the log base 10""" //| ... //| @@ -470,7 +470,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_log10_obj, vectorise_log10); #endif #if ULAB_NUMPY_HAS_LOG2 -//| def log2(a: _ArrayLike) -> ulab.array: +//| def log2(a: _ArrayLike) -> ulab.ndarray: //| """Computes the log base 2""" //| ... //| @@ -480,7 +480,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_log2_obj, vectorise_log2); #endif #if ULAB_NUMPY_HAS_RADIANS -//| def radians(a: _ArrayLike) -> ulab.array: +//| def radians(a: _ArrayLike) -> ulab.ndarray: //| """Converts angles from degrees to radians""" //| ... //| @@ -497,7 +497,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_radians_obj, vectorise_radians); #endif #if ULAB_NUMPY_HAS_SIN -//| def sin(a: _ArrayLike) -> ulab.array: +//| def sin(a: _ArrayLike) -> ulab.ndarray: //| """Computes the sine function""" //| ... //| @@ -507,7 +507,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_sin_obj, vectorise_sin); #endif #if ULAB_NUMPY_HAS_SINH -//| def sinh(a: _ArrayLike) -> ulab.array: +//| def sinh(a: _ArrayLike) -> ulab.ndarray: //| """Computes the hyperbolic sine""" //| ... //| @@ -517,7 +517,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_sinh_obj, vectorise_sinh); #endif #if ULAB_NUMPY_HAS_SQRT -//| def sqrt(a: _ArrayLike) -> ulab.array: +//| def sqrt(a: _ArrayLike) -> ulab.ndarray: //| """Computes the square root""" //| ... //| @@ -527,7 +527,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_sqrt_obj, vectorise_sqrt); #endif #if ULAB_NUMPY_HAS_TAN -//| def tan(a: _ArrayLike) -> ulab.array: +//| def tan(a: _ArrayLike) -> ulab.ndarray: //| """Computes the tangent""" //| ... //| @@ -537,7 +537,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorise_tan_obj, vectorise_tan); #endif #if ULAB_NUMPY_HAS_TANH -//| def tanh(a: _ArrayLike) -> ulab.array: +//| def tanh(a: _ArrayLike) -> ulab.ndarray: //| """Computes the hyperbolic tangent""" //| ... @@ -595,7 +595,7 @@ const mp_obj_type_t vectorise_function_type = { //| f: Union[Callable[[int], float], Callable[[float], float]], //| *, //| otypes: Optional[_DType] = None -//| ) -> Callable[[_ArrayLike], ulab.array]: +//| ) -> Callable[[_ArrayLike], ulab.ndarray]: //| """ //| :param callable f: The function to wrap //| :param otypes: List of array types that may be returned by the function. None is interpreted to mean the return value is float. diff --git a/code/scipy/signal/signal.c b/code/scipy/signal/signal.c index 09e92d79..0c2d9168 100644 --- a/code/scipy/signal/signal.c +++ b/code/scipy/signal/signal.c @@ -21,9 +21,9 @@ #include "../../numpy/fft/fft_tools.h" #if ULAB_SCIPY_SIGNAL_HAS_SPECTROGRAM -//| def spectrogram(r: ulab.array) -> ulab.array: +//| def spectrogram(r: ulab.ndarray) -> ulab.ndarray: //| """ -//| :param ulab.array r: A 1-dimension array of values whose size is a power of 2 +//| :param ulab.ndarray r: A 1-dimension array of values whose size is a power of 2 //| //| Computes the spectrum of the input signal. This is the absolute value of the (complex-valued) fft of the signal. //| This function is similar to scipy's ``scipy.signal.spectrogram``.""" diff --git a/code/ulab_create.c b/code/ulab_create.c index b68424b1..9e66464e 100644 --- a/code/ulab_create.c +++ b/code/ulab_create.c @@ -82,9 +82,9 @@ static ndarray_obj_t *create_linspace_arange(mp_float_t start, mp_float_t step, #if ULAB_NUMPY_HAS_ARANGE //| @overload -//| def arange(stop: _float, step: _float = 1, *, dtype: _DType = ulab.float) -> ulab.array: ... +//| def arange(stop: _float, step: _float = 1, *, dtype: _DType = ulab.float) -> ulab.ndarray: ... //| @overload -//| def arange(start: _float, stop: _float, step: _float = 1, *, dtype: _DType = ulab.float) -> ulab.array: +//| def arange(start: _float, stop: _float, step: _float = 1, *, dtype: _DType = ulab.float) -> ulab.ndarray: //| """ //| .. param: start //| First value in the array, optional, defaults to 0 @@ -149,7 +149,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(create_arange_obj, 1, create_arange); #endif #if ULAB_NUMPY_HAS_CONCATENATE -//| def concatenate(arrays: Tuple[ulab.array], *, axis: int = 0) -> ulab.array: +//| def concatenate(arrays: Tuple[ulab.ndarray], *, axis: int = 0) -> ulab.ndarray: //| """ //| .. param: arrays //| tuple of ndarrays @@ -274,7 +274,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(create_concatenate_obj, 1, create_concatenate); #endif #if ULAB_NUMPY_HAS_DIAG -//| def diag(a: ulab.array, *, k: int = 0) -> ulab.array: +//| def diag(a: ulab.ndarray, *, k: int = 0) -> ulab.ndarray: //| """ //| .. param: a //| an ndarray @@ -347,7 +347,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(create_diag_obj, 1, create_diag); #if ULAB_MAX_DIMS > 1 #if ULAB_NUMPY_HAS_EYE -//| def eye(size: int, *, M: Optional[int] = None, k: int = 0, dtype: _DType = ulab.float) -> ulab.array: +//| def eye(size: int, *, M: Optional[int] = None, k: int = 0, dtype: _DType = ulab.float) -> ulab.ndarray: //| """Return a new square array of size, with the diagonal elements set to 1 //| and the other elements set to 0.""" //| ... @@ -396,7 +396,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(create_eye_obj, 1, create_eye); #endif /* ULAB_MAX_DIMS > 1 */ #if ULAB_NUMPY_HAS_FULL -//| def full(shape: Union[int, Tuple[int, ...]], fill_value: Union[_float, _bool], *, dtype: _DType = ulab.float) -> ulab.array: +//| def full(shape: Union[int, Tuple[int, ...]], fill_value: Union[_float, _bool], *, dtype: _DType = ulab.float) -> ulab.ndarray: //| """ //| .. param: shape //| Shape of the array, either an integer (for a 1-D array) or a tuple of integers (for tensors of higher rank) @@ -437,7 +437,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(create_full_obj, 0, create_full); //| num: int = 50, //| endpoint: _bool = True, //| retstep: _bool = False -//| ) -> ulab.array: +//| ) -> ulab.ndarray: //| """ //| .. param: start //| First value in the array @@ -503,7 +503,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(create_linspace_obj, 2, create_linspace); //| num: int = 50, //| endpoint: _bool = True, //| base: _float = 10.0 -//| ) -> ulab.array: +//| ) -> ulab.ndarray: //| """ //| .. param: start //| First value in the array @@ -577,7 +577,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(create_logspace_obj, 2, create_logspace); #endif #if ULAB_NUMPY_HAS_ONES -//| def ones(shape: Union[int, Tuple[int, ...]], *, dtype: _DType = ulab.float) -> ulab.array: +//| def ones(shape: Union[int, Tuple[int, ...]], *, dtype: _DType = ulab.float) -> ulab.ndarray: //| """ //| .. param: shape //| Shape of the array, either an integer (for a 1-D array) or a tuple of 2 integers (for a 2-D array) @@ -606,7 +606,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(create_ones_obj, 0, create_ones); #endif #if ULAB_NUMPY_HAS_ZEROS -//| def zeros(shape: Union[int, Tuple[int, ...]], *, dtype: _DType = ulab.float) -> ulab.array: +//| def zeros(shape: Union[int, Tuple[int, ...]], *, dtype: _DType = ulab.float) -> ulab.ndarray: //| """ //| .. param: shape //| Shape of the array, either an integer (for a 1-D array) or a tuple of 2 integers (for a 2-D array)