From bd57ac8938b9c8f9a703838f87dc6df4d090d414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20V=C3=B6r=C3=B6s?= Date: Sun, 16 Jan 2022 16:17:06 +0100 Subject: [PATCH 1/3] include uinstd.h header --- code/numpy/transform.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/numpy/transform.c b/code/numpy/transform.c index 0ab2464..f8f2484 100644 --- a/code/numpy/transform.c +++ b/code/numpy/transform.c @@ -9,9 +9,10 @@ * */ +#include +#include #include #include -#include #include "py/obj.h" #include "py/runtime.h" #include "py/misc.h" From 74ee335758e62528755147d3c3b9999b0b7d29d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20V=C3=B6r=C3=B6s?= Date: Sun, 16 Jan 2022 16:20:53 +0100 Subject: [PATCH 2/3] remove printout --- snippets/json_to_ndarray.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/json_to_ndarray.py b/snippets/json_to_ndarray.py index 46c9ec6..eaeb7f8 100644 --- a/snippets/json_to_ndarray.py +++ b/snippets/json_to_ndarray.py @@ -59,7 +59,7 @@ def json_to_ndarray(json_string, b64=True): json_to_ndarray(str, b64=True) """ obj = json.loads(json_string) - print(obj) + if not isinstance(obj, dict): raise TypeError('input argument must be a dictionary') if set(obj.keys()) != {'array', 'dtype', 'shape'}: From 4739e064731658bbb6da7f7f09a9783ca4d1c9f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20V=C3=B6r=C3=B6s?= Date: Tue, 18 Jan 2022 16:42:03 +0100 Subject: [PATCH 3/3] fix ndarray_copy_view for Boolean dtypes --- code/ndarray.c | 11 ++--------- code/ulab.c | 2 +- docs/ulab-change-log.md | 6 ++++++ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/code/ndarray.c b/code/ndarray.c index ddfa44d..3fc3761 100644 --- a/code/ndarray.c +++ b/code/ndarray.c @@ -387,14 +387,6 @@ MP_DEFINE_CONST_FUN_OBJ_0(ndarray_get_printoptions_obj, ndarray_get_printoptions mp_obj_t ndarray_get_item(ndarray_obj_t *ndarray, void *array) { // returns a proper micropython object from an array if(!ndarray->boolean) { - #if ULAB_SUPPORTS_COMPLEX - if(ndarray->dtype == NDARRAY_COMPLEX) { - mp_float_t *c = (mp_float_t *)array; - mp_float_t real = *c++; - mp_float_t imag = *c; - return mp_obj_new_complex(real, imag); - } - #endif return mp_binary_get_val_array(ndarray->dtype, array, 0); } else { if(*(uint8_t *)array) { @@ -735,8 +727,9 @@ ndarray_obj_t *ndarray_copy_view(ndarray_obj_t *source) { uint8_t dtype = source->dtype; if(source->boolean) { - dtype = NDARRAY_BOOLEAN; + dtype = NDARRAY_BOOL; } + // printf("%d\n", dtype); ndarray_obj_t *ndarray = ndarray_new_ndarray(source->ndim, source->shape, strides, dtype); ndarray_copy_array(source, ndarray, 0); return ndarray; diff --git a/code/ulab.c b/code/ulab.c index a65f54a..4d0f490 100644 --- a/code/ulab.c +++ b/code/ulab.c @@ -33,7 +33,7 @@ #include "user/user.h" #include "utils/utils.h" -#define ULAB_VERSION 4.2.0 +#define ULAB_VERSION 4.2.1 #define xstr(s) str(s) #define str(s) #s diff --git a/docs/ulab-change-log.md b/docs/ulab-change-log.md index 7d9a359..9f13aab 100644 --- a/docs/ulab-change-log.md +++ b/docs/ulab-change-log.md @@ -1,3 +1,9 @@ +Tue, 18 Jan 2022 + +version 4.2.1 + + fix ndarray_copy_view for Boolean dtypes + Fri, 14 Jan 2022 version 4.2.0