有没有办法明确键入使用numba' jitclass
(v.25)编译的类的方法?
LFSR的示例实现:
@numba.jitclass([('charpoly',numba.uint64)])
class LFSR(object):
def __init__(self,charpoly):
self.charpoly = charpoly
# @numba.njit('u8(u8,u8)')
def advance(self,state,n):
for k in range(n):
state = (state>>1) ^ (self.charpoly if (state&1) else 0)
return state
取消注释注释行将使numba抱怨self
参数缺少类型声明,但应该放在那里?