在我的代码中,有很多参数在运行过程中是不变的。我定义了一个dict类型变量来存储它们。但我发现numba不能支持dict.
有什么更好的方法来解决这个问题?
我正在使用numba0.34.0和numpy1.13.1。一个小例子如下所示:
import numpy as np
from numba import jit
@jit(nopython=True)
def initial(veh_size):
t = np.linspace(0, (100 - 1) * 30, 100, dtype=np.int32)
t0 = np.linspace(0, (veh_size - 1) * 30, veh_size, dtype=np.int32)
return t0
initial(100)
Run Code Online (Sandbox Code Playgroud)
与t和的行都具有t0相同的错误消息。
错误信息:
Run Code Online (Sandbox Code Playgroud)numba.errors.InternalError: [1] During: resolving callee type: Function(<function linspace at 0x000001F977678C80>) [2] During: typing of call at ***/test1.py (6)
我在安装traj-dist 使用Cython. 在Linux下使用gcc编译后可以安装,但在winodws下使用mingw64 gcc编译后无法安装。
我使用Python 3.8,Cython 0.29.21。
python setup.py build_ext --inplace --force
完整的输出错误消息在这里
Error compiling Cython file:
------------------------------------------------------------
...
q=len(Q)
cc=_compute_critical_values(P,Q,p,q)
eps=cc[0]
while(len(cc)!=1):
m_i=len(cc)/2-1
^
------------------------------------------------------------
traj_dist\cydist\frechet.pyx:535:21: Cannot assign type 'double' to 'int'
Run Code Online (Sandbox Code Playgroud)
有编译错误的文件是https://github.com/bguillouet/traj-dist/blob/master/traj_dist/cydist/frechet.pyx
我怎样才能在windows下编译它?