I'm using the stable version of Numba 0.30.1.
I can do this:
import numba as nb
@nb.jit("void(f8[:])",nopython=True)
def complicated(x):
for a in x:
b = a**2.+a**3.
as a test case, and the speedup is enormous. But I don't know how to proceed if I need to speed up a function inside a class.
import numba as nb
def myClass(object):
def __init__(self):
self.k = 1
#@nb.jit(???,nopython=True)
def complicated(self,x):
for a in x:
b = a**2.+a**3.+self.k
What numba type do I use for the self
object? I need to have this function inside a class since it needs to access a member variable.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…