diff --git a/code/numerical.c b/code/numerical.c index 882fdc52..dcefe558 100644 --- a/code/numerical.c +++ b/code/numerical.c @@ -187,9 +187,6 @@ static mp_obj_t numerical_argmin_argmax_ndarray(ndarray_obj_t *ndarray, mp_obj_t axis_sorter(ndarray, axis, &m, &n, &N, &increment, &len, &start_inc); ndarray_obj_t *results; if((optype == NUMERICAL_ARGMIN) || (optype == NUMERICAL_ARGMAX)) { - // we could save some RAM by taking NDARRAY_UINT8, if the dimensions - // are smaller than 256, but the code would become more involving - // (we would also need extra flash space) if(ndarray->array->len == 0) { mp_raise_ValueError(translate("attempt to get argmin/argmax of an empty sequence")); } @@ -201,23 +198,23 @@ static mp_obj_t numerical_argmin_argmax_ndarray(ndarray_obj_t *ndarray, mp_obj_t for(size_t j=0; j < N; j++) { // result index start = j * start_inc; if((optype == NUMERICAL_MAX) || (optype == NUMERICAL_MIN)) { - if((ndarray->array->typecode == NDARRAY_UINT8)) { + if(ndarray->array->typecode == NDARRAY_UINT8) { RUN_ARGMIN(ndarray, results, uint8_t, uint8_t, len, start, increment, optype, j); - } else if((ndarray->array->typecode == NDARRAY_INT8)) { + } else if(ndarray->array->typecode == NDARRAY_INT8) { RUN_ARGMIN(ndarray, results, int8_t, int8_t, len, start, increment, optype, j); - } if((ndarray->array->typecode == NDARRAY_UINT16)) { + } else if(ndarray->array->typecode == NDARRAY_UINT16) { RUN_ARGMIN(ndarray, results, uint16_t, uint16_t, len, start, increment, optype, j); - } else if((ndarray->array->typecode == NDARRAY_INT16)) { + } else if(ndarray->array->typecode == NDARRAY_INT16) { RUN_ARGMIN(ndarray, results, int16_t, int16_t, len, start, increment, optype, j); } else { RUN_ARGMIN(ndarray, results, mp_float_t, mp_float_t, len, start, increment, optype, j); } - } else { + } else { // argmin/argmax if((ndarray->array->typecode == NDARRAY_UINT8)) { RUN_ARGMIN(ndarray, results, uint8_t, uint16_t, len, start, increment, optype, j); } else if((ndarray->array->typecode == NDARRAY_INT8)) { RUN_ARGMIN(ndarray, results, int8_t, uint16_t, len, start, increment, optype, j); - } if((ndarray->array->typecode == NDARRAY_UINT16)) { + } else if((ndarray->array->typecode == NDARRAY_UINT16)) { RUN_ARGMIN(ndarray, results, uint16_t, uint16_t, len, start, increment, optype, j); } else if((ndarray->array->typecode == NDARRAY_INT16)) { RUN_ARGMIN(ndarray, results, int16_t, uint16_t, len, start, increment, optype, j); @@ -227,7 +224,7 @@ static mp_obj_t numerical_argmin_argmax_ndarray(ndarray_obj_t *ndarray, mp_obj_t } } if(results->array->len == 1) { - return mp_binary_get_val_array(results->array->typecode, results->array->items, 0); + return mp_binary_get_val_array(results->array->typecode, results->array->items, 0); } return MP_OBJ_FROM_PTR(results); } diff --git a/code/ulab.c b/code/ulab.c index f259f5c9..c7d84b53 100644 --- a/code/ulab.c +++ b/code/ulab.c @@ -32,7 +32,7 @@ #include "approx.h" #include "extras.h" -STATIC MP_DEFINE_STR_OBJ(ulab_version_obj, "0.51.0"); +STATIC MP_DEFINE_STR_OBJ(ulab_version_obj, "0.51.1"); MP_DEFINE_CONST_FUN_OBJ_KW(ndarray_flatten_obj, 1, ndarray_flatten); diff --git a/docs/ulab-change-log.md b/docs/ulab-change-log.md index 9c6121a1..389105c8 100644 --- a/docs/ulab-change-log.md +++ b/docs/ulab-change-log.md @@ -1,3 +1,9 @@ +Mon, 29 Jun 202 + +version 0.51.1 + + fixed argmin/argmax issue + Fri, 19 Jun 2020 version 0.51.0