replaced fabs by platform-agnostic version
This commit is contained in:
commit
1df50af368
3 changed files with 8 additions and 8 deletions
|
|
@ -580,7 +580,7 @@ mp_obj_t ndarray_iternext(mp_obj_t self_in) {
|
|||
ndarray_obj_t *ndarray = MP_OBJ_TO_PTR(self->ndarray);
|
||||
// TODO: in numpy, ndarrays are iterated with respect to the first axis.
|
||||
size_t iter_end = 0;
|
||||
if((ndarray->m == 1)) {
|
||||
if(ndarray->m == 1) {
|
||||
iter_end = ndarray->array->len;
|
||||
} else {
|
||||
iter_end = ndarray->m;
|
||||
|
|
@ -888,12 +888,12 @@ mp_obj_t ndarray_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
|
|||
return ndarray_copy(self_in);
|
||||
}
|
||||
ndarray = MP_OBJ_TO_PTR(ndarray_copy(self_in));
|
||||
if((self->array->typecode == NDARRAY_INT8)) {
|
||||
if(self->array->typecode == NDARRAY_INT8) {
|
||||
int8_t *array = (int8_t *)ndarray->array->items;
|
||||
for(size_t i=0; i < self->array->len; i++) {
|
||||
if(array[i] < 0) array[i] = -array[i];
|
||||
}
|
||||
} else if((self->array->typecode == NDARRAY_INT16)) {
|
||||
} else if(self->array->typecode == NDARRAY_INT16) {
|
||||
int16_t *array = (int16_t *)ndarray->array->items;
|
||||
for(size_t i=0; i < self->array->len; i++) {
|
||||
if(array[i] < 0) array[i] = -array[i];
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ mp_obj_t poly_polyfit(size_t n_args, const mp_obj_t *args) {
|
|||
if(!object_is_nditerable(args[0])) {
|
||||
mp_raise_ValueError("input data must be an iterable");
|
||||
}
|
||||
uint16_t lenx, leny;
|
||||
uint8_t deg;
|
||||
uint16_t lenx = 0, leny = 0;
|
||||
uint8_t deg = 0;
|
||||
mp_float_t *x, *XT, *y, *prod;
|
||||
|
||||
if(n_args == 2) { // only the y values are supplied
|
||||
|
|
|
|||
|
|
@ -5116,11 +5116,11 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 504,
|
||||
"execution_count": 507,
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2019-11-14T19:23:36.725005Z",
|
||||
"start_time": "2019-11-14T19:23:36.718109Z"
|
||||
"end_time": "2019-11-14T19:27:23.050475Z",
|
||||
"start_time": "2019-11-14T19:27:23.043203Z"
|
||||
},
|
||||
"code_folding": []
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue