2.4. Utilities¶
2.4.1. Dealing with pointers¶
These functions can be called from pure Python as well as in nopython mode.
- numba.carray(ptr, shape, dtype=None)¶
Return a Numpy array view over the data pointed to by ptr with the given shape, in C order. If dtype is given, it is used as the array’s dtype, otherwise the array’s dtype is inferred from ptr‘s type. As the returned array is a view, not a copy, writing to it will modify the original data.
ptr should be a ctypes pointer object (either a typed pointer as created using POINTER(), or a c_void_p).
shape should be an integer or a tuple of integers.
dtype should be a Numpy dtype or scalar class (i.e. both np.dtype('int8') and np.int8 are accepted).