python - Numba returns NotImplemented Error - cell vars are not supported -
somehow numba not want compile function. have suspicion might connected lambda functions internet revealed nothing. error code is:
numba returns notimplemented error - cell vars not supported
my file:
from __future__ import division scipy import special math import exp,sqrt import numba nb import numpy np @nb.jit def build_cov_matrix(n,t,h,rho): # initialisation of variables sigma = np.zeros((2*n,2*n)) # initialise covariance matrix sigma t_grid = np.linspace(t/n,t,n) # time grid gamma = 0.5-h # simplifying parameter in calculations d_h = sqrt(2*h)/(h+0.5) # factor used in computation # definition of auxiliary functions itt = lambda x: t_grid[x%n] # translate index time g = lambda x: 2*h*(1/(1-gamma)*x**(-gamma)+gamma/(1-gamma)*x**(-1-gamma)* special.hyp2f1(1,1+gamma,3-gamma,1/x)/(2-gamma)) # covariance matrix building without z_0 , w\tilde_0 i,j in np.ndindex(sigma.shape): if i<n , j<n: sigma[i,j]=min(itt(i),itt(j)) elif i>=n , j>=n: if i==j: sigma[i,j]=itt(i)**(2*h) else: max_time=max(itt(i),itt(j)) min_time=min(itt(i),itt(j)) sigma[i,j]=min_time**(2*h)*g(max_time/min_time) elif i<n , j>=n: sigma[i,j]=rho*d_h*(itt(j)**(h+1/2)-(itt(j)-min(itt(i),itt(j)))**(h+1/2)) elif i>=n , j<n: sigma[i,j]=rho*d_h*(itt(i)**(h+1/2)-(itt(i)-min(itt(i),itt(j)))**(h+1/2)) return sigma *note: aware code has indented didn't know how simultaneously lines , lazy manually, sorry. *
Comments
Post a Comment