@@ -190,10 +190,6 @@ static mp_obj_t numerical_sum_mean_std_iterable(mp_obj_t oin, uint8_t optype, si
190190
191191static mp_obj_t numerical_sum_mean_std_ndarray (ndarray_obj_t * ndarray , mp_obj_t axis , uint8_t optype , size_t ddof ) {
192192 uint8_t * array = (uint8_t * )ndarray -> array ;
193- size_t * shape = m_new (size_t , ULAB_MAX_DIMS );
194- memset (shape , 0 , sizeof (size_t )* ULAB_MAX_DIMS );
195- int32_t * strides = m_new (int32_t , ULAB_MAX_DIMS );
196- memset (strides , 0 , sizeof (uint32_t )* ULAB_MAX_DIMS );
197193
198194 if (axis == mp_const_none ) {
199195 // work with the flattened array
@@ -305,7 +301,7 @@ static mp_obj_t numerical_sum_mean_std_ndarray(ndarray_obj_t *ndarray, mp_obj_t
305301 RUN_MEAN (mp_float_t , array , results , r , _shape_strides );
306302 }
307303 } else { // this case is certainly the standard deviation
308- results = ndarray_new_dense_ndarray (MAX (1 , ndarray -> ndim - 1 ), shape , NDARRAY_FLOAT );
304+ results = ndarray_new_dense_ndarray (MAX (1 , ndarray -> ndim - 1 ), _shape_strides . shape , NDARRAY_FLOAT );
309305 // we can return the 0 array here, if the degrees of freedom is larger than the length of the axis
310306 if (_shape_strides .shape [0 ] <= ddof ) {
311307 return MP_OBJ_FROM_PTR (results );
0 commit comments