I am trying to compile a simple function that takes an python list and then split it according to a list of index. I am new to numba and the docs have not help me.
Problem I cant successfully compile the function
Code to compile The arr variable is a python list of floats or integers and idx is a numpy array or python list of integers, the result out should be a 2d python list of floats or integers according to arr input
from numba.pycc import CC
cc = CC('trial')
# Uncomment the following line to print out the compilation steps
cc.verbose = True
@cc.export('split_numba', 'f8[:](f8[:], i4[:])')
def split_numba(arr, idx):
out = []
s = 0
for n in range(len(idx)):
e = idx[n]
out.append(arr[s:e])
s = e
return out
if __name__ == "__main__":
cc.compile()
Error
No conversion from list(array(float64, 1d, A))<iv=None> to array(float64, 1d, A) for '$60return_value.1', defined at None
File "RUT_COMPILE.py", line 38:
def split_numba(arr, idx):
<source elided>
return out
^
During: typing of assignment at C:\Users\chelo\OneDrive\ALCANTARILLADO_PyQt5\00_MODULOS\RUT_COMPILE.py (38)
File "RUT_COMPILE.py", line 38:
def split_numba(arr, idx):
<source elided>
return out