Since Numba 0.19, you can explicitly create numpy arrays in nopython mode. How to create an array of a certain type?
from numba import jit
import numpy as np
@jit(nopython=True)
def f():
a = np.zeros(5, dtype = np.int)
The above code does not work with the following error
TypingError: Failed at nopython (nopython frontend)
Undeclared Function(<built-in function zeros>)(int32, Function(<class 'int'>))
File "<ipython-input-4-3169be7a8201>", line 6
source
share