Python / Numba: Unknown attribute error using scipy.special.gammainc ()

I get an error while running the code using the @jit decorator. It seems that some information for the scipy.special.gammainc () function cannot be located:

Failed at nopython (nopython frontend)
Unknown attribute 'gammainc' for Module(<module 'scipy.special' from 'C:\home\Miniconda\lib\site-packages\scipy\special\__init__.pyc'>) $164.2 $164.3 = getattr(attr=gammainc, value=$164.2)

Without the @jit decorator, the code will work fine. Maybe there is something that is needed for the scipy.special attributes of the module to be visible to Numba?

Thanks in advance for any suggestions, comments, etc.

+4
source share
1 answer

, gammainc , Numba , (. http://numba.pydata.org/numba-doc/dev/reference/numpysupported.html) - scipy- . , "nopython", - python.

nopython=True, . , . , , . , :

  • ( , gammainc) , nopython.

  • gammainc - "ufunc", , .

  • func.inspect_types(), , .

:

from scipy.special import gammainc
import numba as nb
import numpy as np

@nb.jit # note - no "nopython"
def f(x):
  for n in range(x.shape[0]):
    x[n] += 1
  y = gammainc(x,2.5)
  for n in range(y.shape[0]):
    y[n] -= 1
  return y

f(np.linspace(0,20)) # forces it to be JIT'd and outputs an array

f.inspect_types() " ", , JIT'd . gammainc JIT'd, .

+4

All Articles