I looked into eager compilation on numba's website and couldnt figure out, how to specify the types:
The example they use is this:
from numba import jit, int32
@jit(int32(int32, int32))
def f(x, y):
# A somewhat trivial example
return x + y
# source: http://numba.pydata.org/numba-doc/latest/user/jit.html#eager-compilation
as you can see it gets 2 variables as input and returns one single variable. all of them should be int32.
One way to understand the decorator is that @jit(int32(int32, int32)) could be understood as:
@jit(type_of_returned_value(type_of_x, type_of_b))
If that is right (Is that right?), then how do you specify it for multiple inputs and outputs?
Like this:
@nb.jit
def filter3(a,b):
return a > b
@nb.jit
def func3(list_of_arrays_A, list_of_arrays_B, list_of_arrays_C, list_of_arrays_D, 2d_numpy_array_of_objects):
for i in range(len(list_of_arrays_A)):
for j in range(list_of_arrays_A[i].size):
if filter3(list_of_arrays_A[i][j],list_of_arrays_B[i][j]):
2d_numpy_array_of_objects[i][j] = 1
elif filter3(list_of_arrays_B[i][j],list_of_arrays_A[i][j]):
2d_numpy_array_of_objects[i][j] = 0
elif filter3(list_of_arrays_C[i][j],list_of_arrays_D[i][j]):
2d_numpy_array_of_objects[i][j] = 0
else:
2d_numpy_array_of_objects[i][j] = 1
'''
My intention: Since i need to speed up a function which is only called once, (but takes forever if **not** done with numba), I need to speed up its numba-compilation