Hi
I am trying to write a simple example using Numba as follows
==============================================================
from numba import d, i
from numba.decorators import jit as jit
import numpy as np
def viterbi_decode(coded_bits, k, n, total_memory):
rate = k/n
return rate
viterbi_decode_numba = jit(ret_type=d, arg_types=[d[:], d, d, i])(viterbi_decode)
cbits = np.array([1,0,1,1,0,1,1], dtype=float)
k = 1
n = 3
total_memory = 6
rate = viterbi_decode_numba(cbits, k, n, total_memory)
print rate
===============================================================
The error i get is as follows:
===============================================================
Traceback (most recent call last):
File "viterbi_numba.py", line 14, in <module>
viterbi_decode_numba = jit(ret_type=d, arg_types=[d[:], d, d, i])(viterbi_decode)
File "/usr/local/lib/python2.7/dist-packages/numba/decorators.py", line 81, in _jit
return t.get_ctypes_func(llvm)
File "/usr/local/lib/python2.7/dist-packages/numba/translate.py", line 1145, in get_ctypes_func
for x in self.arg_types])
File "/usr/local/lib/python2.7/dist-packages/numba/translate.py", line 377, in convert_to_ctypes
dtype_str = np.dtype(typ).str
TypeError: data type not understood
================================================================
However this error goes away if i pass the last argument 'total_memory' as a double, i.e., d instead of i in the arg_types list.
Any ideas if I am doing something the wrong way?
Thanks,
Veeresh Taranalli