This commit is contained in:
Hugo Saint-Vignes 2025-06-24 20:05:41 +00:00 committed by GitHub
commit 6901deee26
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View file

@ -433,6 +433,7 @@ void ndarray_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t ki
ndarray_print_bracket(print, 0, self->shape[ULAB_MAX_DIMS-4], "]");
#endif
}
#if ULAB_PRINT_DTYPE
mp_print_str(print, ", dtype=");
if(self->boolean) {
mp_print_str(print, "bool)");
@ -457,6 +458,9 @@ void ndarray_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t ki
mp_print_str(print, "float64)");
#endif
}
#else
mp_print_str(print, ")");
#endif
}
void ndarray_assign_elements(ndarray_obj_t *ndarray, mp_obj_t iterable, uint8_t dtype, size_t *idx) {

View file

@ -74,6 +74,11 @@
#define NDARRAY_PRINT_THRESHOLD 10
#define NDARRAY_PRINT_EDGEITEMS 3
// determines whether an array's dtype should be printed with the array
#ifndef ULAB_PRINT_DTYPE
#define ULAB_PRINT_DTYPE (1)
#endif
// determines, whether the dtype is an object, or simply a character
// the object implementation is numpythonic, but requires more space
#ifndef ULAB_HAS_DTYPE_OBJECT