insert circuitpython hooks for flatiter
This commit is contained in:
parent
7690c7a166
commit
c152871dba
2 changed files with 15 additions and 0 deletions
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "ulab.h"
|
||||
#include "ndarray.h"
|
||||
#include "numpy/ndarray/ndarray_iter.h"
|
||||
|
||||
#if CIRCUITPY
|
||||
typedef struct _mp_obj_property_t {
|
||||
|
|
@ -37,6 +38,16 @@ STATIC const mp_obj_property_t ndarray_dtype_obj = {
|
|||
};
|
||||
#endif /* NDARRAY_HAS_DTYPE */
|
||||
|
||||
#if NDARRAY_HAS_FLATITER
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(ndarray_flatiter_make_new_obj, ndarray_flatiter_make_new);
|
||||
STATIC const mp_obj_property_t ndarray_flat_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = {(mp_obj_t)&ndarray_flatiter_make_new_obj,
|
||||
mp_const_none,
|
||||
mp_const_none },
|
||||
};
|
||||
#endif /* NDARRAY_HAS_FLATITER */
|
||||
|
||||
#if NDARRAY_HAS_ITEMSIZE
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(ndarray_get_itemsize_obj, ndarray_itemsize);
|
||||
STATIC const mp_obj_property_t ndarray_itemsize_obj = {
|
||||
|
|
@ -82,6 +93,7 @@ STATIC const mp_obj_property_t ndarray_strides_obj = {
|
|||
void ndarray_properties_attr(mp_obj_t , qstr , mp_obj_t *);
|
||||
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(ndarray_dtype_obj, ndarray_dtype);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(ndarray_flatiter_make_new_obj, ndarray_flatiter_make_new);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(ndarray_itemsize_obj, ndarray_itemsize);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(ndarray_shape_obj, ndarray_shape);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(ndarray_size_obj, ndarray_size);
|
||||
|
|
|
|||
|
|
@ -69,6 +69,9 @@ STATIC const mp_rom_map_elem_t ulab_ndarray_locals_dict_table[] = {
|
|||
#if NDARRAY_HAS_DTYPE
|
||||
{ MP_ROM_QSTR(MP_QSTR_dtype), MP_ROM_PTR(&ndarray_dtype_obj) },
|
||||
#endif
|
||||
#if NDARRAY_HAS_FLATITER
|
||||
{ MP_ROM_QSTR(MP_QSTR_flat), MP_ROM_PTR(&ndarray_flat_obj) },
|
||||
#endif
|
||||
#if NDARRAY_HAS_ITEMSIZE
|
||||
{ MP_ROM_QSTR(MP_QSTR_itemsize), MP_ROM_PTR(&ndarray_itemsize_obj) },
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue