@@ -588,14 +588,14 @@ void ndarray_assign_elements(ndarray_obj_t *ndarray, mp_obj_t iterable, uint8_t
588588bool ndarray_is_dense (ndarray_obj_t * ndarray ) {
589589 // returns true, if the array is dense, false otherwise
590590 // the array should be dense, if the very first stride can be calculated from shape
591- // TODO: this function could probably be removed
592591 int32_t stride = ndarray -> itemsize ;
593- for (uint8_t i = ULAB_MAX_DIMS ; i > ULAB_MAX_DIMS - ndarray -> ndim ; i -- ) {
592+ for (uint8_t i = ULAB_MAX_DIMS - 1 ; i > ULAB_MAX_DIMS - ndarray -> ndim ; i -- ) {
594593 stride *= ndarray -> shape [i ];
595594 }
596- return stride == ndarray -> strides [ULAB_MAX_DIMS - ndarray -> ndim - 1 ] ? true : false;
595+ return stride == ndarray -> strides [ULAB_MAX_DIMS - ndarray -> ndim ] ? true : false;
597596}
598597
598+
599599ndarray_obj_t * ndarray_new_ndarray (uint8_t ndim , size_t * shape , int32_t * strides , uint8_t dtype ) {
600600 // Creates the base ndarray with shape, and initialises the values to straight 0s
601601 ndarray_obj_t * ndarray = m_new_obj (ndarray_obj_t );
@@ -1843,7 +1843,7 @@ mp_obj_t ndarray_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
18431843 #if NDARRAY_HAS_UNARY_OP_ABS
18441844 case MP_UNARY_OP_ABS :
18451845 ndarray = ndarray_copy_view (self );
1846- // if Booleam , NDARRAY_UINT8, or NDARRAY_UINT16, there is nothing to do
1846+ // if Boolean , NDARRAY_UINT8, or NDARRAY_UINT16, there is nothing to do
18471847 if (self -> dtype == NDARRAY_INT8 ) {
18481848 int8_t * array = (int8_t * )ndarray -> array ;
18491849 for (size_t i = 0 ; i < self -> len ; i ++ , array ++ ) {
0 commit comments