No support for array indexing from a reflected list

@jit(nopython=True)
def index_arr(ixes, points):
  return points[ixes]
points = np.random.uniform(-1, 1, (2048, 3)).astype(np.float32)
index_arr([1, 2, 3], points)

returns:

TypeError: unsupported array index type reflected list(int64)<iv=None> in [reflected list(int64)<iv=None>]

Anyways around this other than casting the list as np.array?

The problem is I have a large dictionary with tuples as keys and lists of indices as values. I use this indicies to slice from a numpy array and create a new Typed Dict for passing into a numba jit function.

Unfrotunatelly, looping through this dictionary to get the needed slices takes a very long time since the dictionary is large so I wanted to do this inside the jit function but having a hard time achieving so.

Thanks guys

Hi @ma7555,

Numba does not support indexing using a Python list (reflected list). To circumvent this issue, you can convert the list to a NumPy array:

import numpy as np
from numba import njit

@njit
def index_arr(ixes, points):
    return points[ixes]

points = np.random.uniform(-1, 1, (2048, 3)).astype(np.float32)
print(index_arr(np.array([1, 2, 3]), points))