我正在尝试使用Numba加速我的部分代码。但是,它无法正常工作。实际上,我没有看到任何进步!任何人都可以给我一些建议如何解决它?
顺便说一句,所有输入变量都是1D / 2D / 3D numpy变量
import numba as nb
@nb.jit
def Permutation(Spect, Blob_Len, Fs, alpha, Terminate,
x, y, z, Per_IndexH1, Per_IndexH2, P_Value, MeanSpect, TempPVal, Boundary):
for i in range(Terminate):
TempPVal[:] = 0.0
DS1 = Spect[:, :, Per_IndexH1[i, 0 : Boundary]]
DS2 = Spect[:, :, Per_IndexH2[i, Boundary:]]
MS1 = np.sum(DS1, axis = 2)
MS2 = np.sum(DS2, axis = 2)
TempPVal[np.abs(MS1 - MS2) > MeanSpect] = 1
P_Value = P_Value + TempPVal
P_Value = P_Value / Terminate
return P_Value