Dear everyone,
I’m trying to define an empty list as attribute of a class. The list is going to contain 2-dim float64 arrays (i.e. points on plane).
I found how to define an empty list of floats:
spec = {
'points_pos' : types.ListType(types.float64),
}
@jitclass(spec)
class Class:
def __init__(self):
self.points_pos = typed.List.empty_list(types.float64)
So, I thought that something like this would have worked:
spec = {
'points_pos' : types.ListType(types.float64[:]),
}
@jitclass(spec)
class Class:
def __init__(self):
self.points_pos = typed.List.empty_list(types.float64[:])
Unfortunately, I get the error:
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Failed in nopython mode pipeline (step: nopython frontend)
No implementation of function Function(<built-in function getitem>) found for signature:
>>> getitem(class(float64), slice<a:b>)
There are 22 candidate implementations:
- Of which 22 did not match due to:
Overload of function 'getitem': File: <numerous>: Line N/A.
With argument(s): '(class(float64), slice<a:b>)':
No match.
I can’t understand the reason as it looks like it’s the correct data type. If I try something like, it returns true
vet = typed.List.empty_list(types.float64[:])
numba.typeof(vet) == types.ListType(types.float64[:])
Thank you for any suggestion