Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add complex guard to stats
  • Loading branch information
v923z committed Apr 21, 2021
commit 781874acb9698d4d67223d889ea2eee52da963b8
3 changes: 3 additions & 0 deletions code/numpy/stats/stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

#include "../../ulab.h"
#include "../../ulab_tools.h"
#include "../carray/carray_tools.h"

#include "stats.h"

#if ULAB_MAX_DIMS > 1
Expand All @@ -36,6 +38,7 @@

static mp_obj_t stats_trace(mp_obj_t oin) {
ndarray_obj_t *ndarray = tools_object_is_square(oin);
COMPLEX_DTYPE_NOT_IMPLEMENTED(ndarray->dtype)
mp_float_t trace = 0.0;
for(size_t i=0; i < ndarray->shape[ULAB_MAX_DIMS - 1]; i++) {
int32_t pos = i * (ndarray->strides[ULAB_MAX_DIMS - 1] + ndarray->strides[ULAB_MAX_DIMS - 2]);
Expand Down