Creation np.array in the nopython @jit function

I have nopython @jit function that is working very well with np.arrays.

Now I want to create new np.array in the nopython @jit function and return new array back to python. Could I do such things? Is it OK from memory management and performance point of view?

Hi @alkalinin,

Yes, and most probably, yes and yes! You can create NumPy arrays in compiled functions (np.empty, np.ones, np.zeros are all supported, along with some variants of np.array, see docs on supported NumPy features). If you have a specific use case in relation to performance or memory that is demonstrably not doing something expected, perhaps share an example to discuss?

Hope this helps?