The code is here:
import numba as nb
import numpy as np
@nb.njit
def func(size):
ary = np.array([np.arange(size),np.arange(size)+1,np.arange(size)-1]).T
X = np.array([ary[1:,0] - ary[:-1,2],
ary[1:,1] - ary[:-1,2],
ary[1:,0] - ary[1:,1]
])
return X
Z = func(10**9)
When I run the code, it gives me an error message and I don't really understand what's going on here. Do functions decorated by njit not support creating new arrays inside the functions? Error message is the following:
TypingError: Invalid use of Function(<built-in function array>) with argument(s) of type(s): (list(array(int64, 1d, C)))
* parameterized
In definition 0:
TypingError: array(int64, 1d, C) not allowed in a homogeneous sequence
raised from C:\Users\User\Anaconda3\lib\site-packages\numba\typing\npydecl.py:459
In definition 1:
TypingError: array(int64, 1d, C) not allowed in a homogeneous sequence
raised from C:\Users\User\Anaconda3\lib\site-packages\numba\typing\npydecl.py:459
This error is usually caused by passing an argument of a type that is unsupported by the named function.
[1] During: resolving callee type: Function(<built-in function array>)
[2] During: typing of call at C:/Users/User/Desktop/all python file/3.2.4/nb_datatype.py (65)
EDIT: I forgot to transpose the array before edit, it should be a 10^9 by 3 array.