Hello friendly people
The documentation seems to be a bit unclear about this, so thought I’ll double check here:
base_dtype = np.dtype([(f'x', np.uint32), (f'y', np.uint16), (f'z', np.uint8)])
n_types = 5
complex_dtype = np.dtype([('global1', np.uint32), ('global2', np.int64), ('comp', base_dtype, n_types)])
test_var_arr = np.empty(10, dtype=complex_dtype)
@nb.njit()
def test(struct_arr):
struct_arr.view(np.uint8).fill(0)
for ix in range(n_types):
value_offset = ix * 10
struct_arr[0]['comp'][ix]['x'] = value_offset + 1
struct_arr[0]['comp'][ix]['y'] = value_offset + 2
struct_arr[0]['comp'][ix]['z'] = value_offset + 3
This seems to compile just fine - am I good to go, or should I be wary of something here?
I want to rely heavily on this feature so don’t want to encounter a hiccup on the way
Many thanks in advance - Adrian